# If you want to solve a cubic equation

1. May 4, 2009

### edgo

There is a very handy numerical solution for cubic equations like $$x^3+ax^2+bx+c=0$$ with $$x_i \in R$$ while $a^2-3b \neq 0$. Though it makes use of the method of Newton, the starting point for the algorithm gives it a great advantage to the normal algorithm. And you can use MS Excel as an ordinary calculator!

We compute the parameter $$4d=\frac{-9\left(2a^3-9ab+27c\right)}{\sqrt{12\left(a^2-3b\right)^3-3\left(2a^3-9ab+27c\right)^2}}$$ for the composition of the equation $$\ f^3-4df^2-9f+4d=0$$.

This equation has roots that satisfy $$f_j=\frac{f_i-3}{f_i+1}$$.

Next thing to do is to calculate $$y_0=\frac{4d}{4+\sqrt{16d^2+25}}$$.

We substitute $$y_0$$ in $$y_j=\frac{2y_i^3-4dy_i^2-4d}{3y_i^2-8dy_i-9}$$.

This gives the value $$y_1$$, repeating this step for $$y_1$$ gives $$y_2$$. There is no need to go any further than $$y_2$$ as Excel can’t handle those accuracies any more.

Substitution of $$y_2=f_2$$ in $$f_j=\frac{f_i-3}{f_i+1}$$ gives $$f_i$$. Then:

$$x_i=-\frac{ab-9c}{2a^3-6b}+\frac{f_i}{18a^2-54b}\times \sqrt{12\left(a^2-3b\right)^3-3\left(2a^3-9ab+27c\right)^2}$$.

Just an example: $$x^3+4x^2-18x-9=0$$
$$4d$$ = -2,655 292 734 356 2300
$$y_0$$= - 0,274 837 379 984 0870
$$y_1$$ = - 0,275 027 669 928 0960
$$y_2$$ = - 0,275 027 663 450 8140

Substitution gives
$$x_1$$ = 3,000 000 000 000 0000
$$x_2$$ = -0,458 618 734 850 8900
$$x_3$$ = - 6,541 381 265 149 1100

Check on coefficients:
$$a$$ = 4,000 000 000 000 0000
$$b$$ = - 18, 000 000 000 000 0000
$$c$$ = - 9,000 000 000 000 0000 In Excel!!

For those who want to know: $$|f_2-y_0| < 0,00086$$ for every $$f_2 \in R$$. So for practical use $$y_1$$ will suffice giving an accuracy of about 6 decimals.

Can anybody please tell me what to do about this ridiculous jumping too small figures in LaTeX? \Large doesn't do any good nor itex (the way I used it). Thanks.

Last edited: May 4, 2009