functionccubicRoots

Analytical solution for the roots of a cubic equation (a*x^3+b*x^2+c*x+d=0)

Information

 
Analytical solution to the cubic equation a*x^3 + b*x^2 + c*x + d = 0
using complex algebra as derived at:
http://mathforcollege.com/nm/mws/gen/03nle/mws_gen_nle_bck_exactcubic.pdf.
 
nRoots helps to identify the number of expected real roots based on the
result from the polynomial discriminant, D.

Inputs

TypeNameDefaultDescription
Reala
Realb
Realc
Reald

Outputs

TypeNameDefaultDescription
ComplexrootsReal roots
RealnRootsNumber of distinct real solutions expected