# TITLE: Cubic with Complex Coefficients # AUTHOR: Roy F.A. Maclean # EMAIL: rfamgm at gmail # WEB: http://www.spiderpixel.co.uk/caspro # DATE: 19Sep1996 # MAKE: CASIO # MODEL: fx9700 or greater # SIZE: 516 over 3 program areas # # Enter the coefficients of a cubic equation: AX^3+BX^2+CX+D. # The coeffs may be real or complex. # The roots of the equation will be displayed. # # \10^ is the small 10 above the log button # \pi is the Pi symbol # \i is the complex i @@ Program 0 Lbl 0 Defm 6 Mcl ?->A:?->B:?->C:?->D A=0=>Goto 1 EC/2A-EEE-D/2A->F C/3A-E^2->G F^2+GGG->H F+sqrt H->Z: Prog 1 F-sqrt H->Z: Prog 1 3->I:Lbl A 3->J:Lbl B Z[I]+Z[J+3]-E Prog 2:Ans->X AXXX+BX^2+CX+D->Y Abs Y<1 \10^ -6=>Goto C Dsz J:Goto B Dsz I:Goto A Lbl C:X_ AX^2+BX+C->D AX+B->C A->B Lbl 1 1/2B->K C^2-4BD->M MK^2->L -CK+sqrt L:Prog 2:Ans_ -CK-sqrt L:Prog 2:Ans @@ Program 1 Rad Z=0=>Goto 1 3->W:Lbl 0 (ln Abs Z+\i( Arg Z+2W*\pi ))/3 (cos ImP Ans+\i*sin ImP Ans)e^(ReP Ans)->Z[WN+W] Dsz W:Goto 0 Lbl 1:Isz N @@ Program 2 ReP Ans->P:ImP Ans->Q 0->U:Lbl 0 Abs P[U]->R Int R->S Frac R>=.5=>Isz S R<>0=>P[U]S/R->T R=0=>0->T Abs (T-P[U])<1 \10^ -6=>T->P[U] Isz U:U=1=>Goto 0 P+\iQ