# TITLE: Cubic Solver # AUTHOR: Roy F.A. Maclean # EMAIL: rfamgm at gmail # WEB: http://www.spiderpixel.co.uk/caspro # DATE: 18Sep1996 # MAKE: CASIO # MODEL: fx6300g or greater # SIZE: 227 # NOTES: enter coeffs of cubic polynomial eq, roots will be returned # e.g. for x^3+x^2+x+1 enter 1 3 3 1 at the prompts. # It will also solve quadratics, if you put 0 as the first # coefficient. # If the roots are imaginary it will also return the square of # the imaginary bit so you can see what the surd form is. # \10^ is the small 10 above the log button @@ Program 1 Lbl 0 ?->A:?->B:?->C:?->D A=0=>Goto 1 B/3A->E EC/2A-EEE-D/2A->F C/3A-EE->G FF+GGG->H H>=0=>cbrt(F+sqrt(H))+cbrt(F-sqrt(H))-E->X H<0=>2Rec(cbrt Pol(F,sqrt(-H)),J/3)-E->X Abs X<1 \10^ -10=>0->X X_ XXA+XB+C->D:XA+B->C A->B Lbl 1 1/2B->K CC-4BD->M KK(Abs M)->L M<0=>Goto 2 -CK+sqrt(L)_ -CK-sqrt(L)_ Goto 0 Lbl 2 -CK_ "+-I":sqrtL_ "IM^2":L