mirror of
https://github.com/mfillpot/mathomatic.git
synced 2026-01-09 04:59:37 +00:00
21 lines
1.4 KiB
Plaintext
21 lines
1.4 KiB
Plaintext
|
|
; General cubic (3rd degree polynomial) formula using 3 equations.
|
|
; Formula for the 3 roots (solutions for x) of the general 3rd degree polynomial equation.
|
|
; These formulas always seem to work correctly, whether imaginary or real solutions.
|
|
;
|
|
; This is currently the only way to solve cubic polynomials in Mathomatic,
|
|
; by manually entering the coefficients (a, b, c, and d) into the following equations.
|
|
; To visualize the coefficients of a polynomial equation:
|
|
; solve for 0
|
|
; unfactor
|
|
; factor x
|
|
;
|
|
; See also file "cubic2.in" for using 2 equations instead of 3.
|
|
|
|
a x^3 + b x^2 + c x + d = 0 ; The general cubic equation.
|
|
x_1=-b/{3 a}-1/{3 a} {{2 b^3-9 a b c+27 a^2 d+{(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3}^.5}/{2}}^(1/3)-1/{3 a} {{2 b^3-9 a b c+27 a^2 d-{(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3}^.5}/2}^(1/3)
|
|
x_2=-b/{3 a}+{1+i 3^.5}/{6 a} {{2 b^3-9 a b c+27 a^2 d+{(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3}^.5}/{2}}^(1/3)+{1-i 3^.5}/{6 a} {{2 b^3-9 a b c+27 a^2 d-{(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3}^.5}/2}^(1/3)
|
|
x_3=-b/{3 a}+{1-i 3^.5}/{6 a} {{2 b^3-9 a b c+27 a^2 d+{(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3}^.5}/{2}}^(1/3)+{1+i 3^.5}/{6 a} {{2 b^3-9 a b c+27 a^2 d-{(2 b^3-9 a b c+27 a^2 d)^2-4 (b^2-3 a c)^3}^.5}/2}^(1/3)
|
|
; x_1, x_2, and x_3 are the solutions to the given general cubic equation.
|
|
; Type "calculate all" to temporarily plug in coefficients.
|