TI-BASIC:Cubic Formula

From Learn @ Cemetech
Jump to navigationJump to search


Routine Summary

Solves for the complex roots of a cubic equation.

Inputs

A, B, C, D - the constants in Ax3+Bx2+Cx+D=0

Outputs

The three roots (or repeated roots)

Variables Used

A, B, C, D, M, N, O, P, Q, R, U, V, W

Calculator Compatibility

TI-83/84/+/SE Author

theFlyingDutchmanURL: United TI Download

file cubicformula.zip

ClrHome
Disp "AX³+BX²+CX+D=0
Prompt A,B,C,D
√((2B³-9ABC+27A²D)²-4(B²-AC)³→M
2B³-9ABC+27A²D→R
³√(0.5(R+M→N
³√(0.5(R-M→O
(1+i√(3))/6A→P
(1-i√(3))/6A→Q
-B/(3A)-N/(3A)-O/(3A→U
-B/(3A)+PN+QO→V
-B/(3A)+QN+PO→W
Disp "X1=",U
Disp "X2=",V
Disp "X3=",W

This is the complete program used to give the three roots that solve the cubic equation. If there are less than 3 roots, it will still give three answers. Because the formula used to solve cubic equations is quite big, several repeated parts are turned into variables.