Difference between revisions of "TI-BASIC:Cubic Formula"

From Learn @ Cemetech
Jump to navigationJump to search
(Initial automated import)
 
(Automated superscript correction)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{Template:TI-BASIC:Routine
 
{{Template:TI-BASIC:Routine
|picture=@@
+
|picture=
 
|summary=Solves for the complex roots of a cubic equation.
 
|summary=Solves for the complex roots of a cubic equation.
|input=''A, B, C, D'' - the constants in Ax^^3^^+Bx^^2^^+Cx+D=0
+
|input=''A, B, C, D'' - the constants in Ax<sup>3</sup>+Bx<sup>2</sup>+Cx+D=0
 
|output=The three roots (or repeated roots)
 
|output=The three roots (or repeated roots)
 
|variable=A, B, C, D, M, N, O, P, Q, R, U, V, W
 
|variable=A, B, C, D, M, N, O, P, Q, R, U, V, W
Line 8: Line 8:
 
|author=theFlyingDutchman
 
|author=theFlyingDutchman
 
|url=http://www.unitedti.org/index.php?showtopic=7392&view=findpost&p=116156 United TI
 
|url=http://www.unitedti.org/index.php?showtopic=7392&view=findpost&p=116156 United TI
|authors=@@
+
|authors=
 
|download=[file cubicformula.zip]
 
|download=[file cubicformula.zip]
 
}}
 
}}

Latest revision as of 22:25, 24 February 2016


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.