Cubic Equation Definition:
A cubic equation is a polynomial equation of the third degree. The general form is
ax^{3}+bx^{2}+cx+d=0,
where a ≠ 0.
Cubic Equation Formula :
ax^{3} + bx^{2} + cx + d = 0,
where
a = coefficient of x^{3}
b = coefficient of x^{2}
c = coefficient of x and
d = constant.
Cubic Equation solving formula:
x_{1} = (Term1 + r_{13} * math.cos(q^{3} / 3)
x_{2} = (Term1 + r_{13} * math.cos(q^{3} + (2 * math.PI) / 3)
x_{3} = (Term1 + r_{13} * math.cos(q^{3} + (4 * math.PI) / 3)
where x_{1}, x_{2} and x_{3} are the roots of the cubic equation.
Example 1: Calculate the roots(x1, x2, x3) of the cubic equation,
x ^{3}  4x^{2}  9x + 36 = 0
Step 1: From the above equation, the value of a = 1, b =  4, c =  9 and d = 36.
Step 2: To Find X:
Substitute the values in the formula's below to find the roots. The variable disc is nothing but the discriminant, denoted generally as delta(Δ)
discriminant(Δ) = q^{3} + r^{2}
q = (3c  b^{2}) / 9
r = 27d + b(9c  2b^{2})
s = r + math.sqrt(discriminant)
t = r  math.sqrt(discriminant)
term1 = math.sqrt(3.0) * ((t + s) / 2)
r_{13} = 2 * math.sqrt(q)
Step 3: We get the roots,
x_{1} = 4, x_{2} = 3 and x_{3} = 3. This is an example for real roots in the cubic equation.

