Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > b8ec8bfa2b3d0923a5da0c96615f305f > files > 62

mathomatic-15.7.2-1mdv2010.2.i586.rpm


; This general quartic (4th degree polynomial) formula as
; four equations combined into one is from:
; http://planetmath.org/encyclopedia/QuarticFormula.html
; Not perfect, gives division by zero warnings and NaN for a result
; when most coefficients are 0 or if all four roots are the same.

; The four roots of the general quartic polynomial equation
x^4 + a x^3 + b x^2 + c x + d = 0
; are given by

x = ((-a)/4 + sign * 1/2(((a^2)/4 - (2b)/3 + (2^(1/3)(b^2 - 3a*c + 12d))/(3((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d + ((-4((b^2 - 3a*c + 12d))^3 + ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d))^2)^.5)))^(1/3)) + (((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d + ((-4 ((b^2 - 3a*c + 12d))^3 + ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d))^2)^.5)))/54)^(1/3))^.5) + sign1 * 1/2(((a^2)/2 - (4b)/3 - (2^(1/3)(b^2 - 3a*c + 12d))/(3((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d + ((-4((b^2 - 3a*c + 12d))^3 + ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d))^2)^.5)))^(1/3)) - (((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d + ((-4 ((b^2 - 3a*c + 12d))^3 + ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d))^2)^.5)))/54)^(1/3) + sign (-a^3 + 4a*b - 8c)/(4(((a^2)/4 - (2b)/3 + (2^(1/3) (b^2 - 3a*c + 12d))/(3 ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d + ((-4 ((b^2 - 3a*c + 12d))^3 + ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d))^2)^.5)))^(1/3)) + (((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d + ((-4 ((b^2 - 3a*c + 12d))^3 + ((2b^3 - 9a*b*c + 27c^2 + 27a^2d - 72b*d))^2)^.5)))/54)^(1/3))^.5)))^.5))

; Use the calculate command to temporarily plug in coefficients.