Cubic Equation
Program mode: CMPLX
Program syntax: Lbl 1: ?→A: ?→B: ?→C: ?→D: -B÷(3A→B: B3-.5A-1(BC+D →M: B2-C÷(3A→X: √(M2-X3M+: If M=0: Then -3√(D→X◢ X◢X◢ Goto 1: IfEnd: 3-1arg(M →D: For 0→A To 2: D+120A: 3√(Abs(M)) (cos(Ans)+i sin(Ans: Ans+X÷Ans+B◢Next: Goto 1 (121 bytes or 130 bytes)
Program description: The syntax highlighted in yellow are wrapping-up syntax, which are not necessary. First, rewrite the cubic equation in the form of ax3+bx2+cx+d=0. For example, x3-3x2-6x+8=0. Then start the program and type the coefficients of x from the highest power to the lowest power. For the above example, you should type [1][EXE][-3][EXE][-6][EXE][8][EXE]. After that, one of the roots will be displayed. Press [EXE] once to see the other roots and one more time to see the remaining root.
Notes:
The syntax highlighted in green (M+) is one whole syntax rather than ‘M’ and ‘+’. Just type [M+], which is the key above [AC], but NOT [ALPHA][M+][+].
The display order of the roots does not follow a specific sequence.
If you see ‘R<=>I’ appears on the top right hand corner of the calculator screen, it means that the root is a complex root. The display will show the real part of the root and you may press [SHIFT][EXE] to see the imaginary part. If you do not need the complex root, you may just ignore it.
If you press [EXE] one more time after all the roots are displayed, the screen will show ‘Math ERROR’ if all the roots are the same, or it will show the word ‘Next’ and the last root if the roots are not the same. Just ignore those dummy outputs. If you find them disturbing, you may include the wrapping-up syntax to prevent those dummy outputs from being displayed.