( only for real+complex roots; for real roots this will fail. click here)
|*The cubic equation with real co-efficient will have 3 roots.
These roots are either all real or 1 real, 2 complex with one being
the complex conjugate of another.
* Let the equation be ax3 + bx2 + cx + d =0
* to find the roots , let us calculate the following:-
Δ0= b2 - 3ac ; when a=1, Δ0= b2 - 3c
Δ'0= - Δ0/9 =c/3 - b2/9 (when a=1)
Δ1= 2b3 - 9abc + 27a2d ; when a=1, Δ1= 2b3 - 9bc + 27d
Δ'1= - Δ1/54=(b/3)*(c/2) -(b/3)3 - d/2 (when a=1)
if D < 0, all roots are real, distinct
if D = 0, all roots real, at least two are same.
if D > 0, one root real, rest two are complex conjugates of each other.
C = ∛[(Δ1 + √(Δ21 -4Δ30))/2]
x1=(1/-3a)(b+ C + Δ0 /C)
x(2&3) =b + ξ2C + Δ0 /ξ2C where ξ=(-1+√3i) /2 and ξ2 =-(1+√3i) / 2;
x2=(b - C/2 - Δ0/2C ) + (C2 -Δ0 )i /(2√3aC) ;
x3=(b - C/2 - Δ0/2C ) - (C2 -Δ0 )i /(2√3aC) ;
* If discriminant of the cubic > 0 , then there are 3 distinct real roots.
If discriminant of the cubic < 0 , then there is 1 real and 2 complex roots , one being the complex conjugate of the other.
If discriminant of the cubic = 0 , then all real & multiple roots.
* In depressed cubic equation, ti = xi + b/3a where i=1,2,3