# Roots of a Quartic Equation

1. Jun 3, 2010

### scottlangendy

Hey guys,

I've been working on this computer application, and ended up needing to compute the roots of a quartic equation. So I implemented Ferrari's method and the results for the most part are working, however I've come across a few exceptions where I'm getting incorrect results.

For example if I try and calculate the roots for this equation:

y = 0.9604000000000001x^4 - 5.997600000000001x^3 + 13.951750054511718x^2 - 14.326264455924333x + 5.474214401412618

It returns the following roots:
1.7820304835380467 + 0i
1.34041662585388 + 0i
1.3404185025061823 + 0i
1.7820323472855648 + 0i

When I graph the equation with a graphing calculator, I find that these are actually incorrect, and the real roots are actually closer to 1.2 and 2.9 (approximately).

The results its returning aren't totally random, they actually seem to be the results of the equations first derivative.

I tried out a bunch of root calculators online (I presume they are using the same method) and they returned the same results, so I'm pretty certain I've implemented the formula correcting.

This only seems to happen when the quartic has only two real roots, so I'm under the impression that I'm ignoring some sort of special case!

Can anyone offer me any insight as to why this is happening?

2. Jun 3, 2010

### jaycool1995

I am not at all an expert on quadratic functions, but i will just input what mathematica (you could also check this at wolfram alpha) has given as a result: $$x=1.20784$$ or $$x=1.56122-0.165428 i$$ or $$x=1.56122+0.165428 i$$ or $$x=1.9146$$ , which if then we use the plot we can see that the intersects are marked on the graph, which looks like the two end results (1.207 and 1.9146).
Hope that helps :)

#### Attached Files:

File size:
3.4 KB
Views:
159
Last edited: Jun 3, 2010
3. Jun 3, 2010

4. Jun 3, 2010

### scottlangendy

The issue isn't so much as finding the roots for a specific quartic equation, its that I need to be able to dynamically calculate it programatically, for any quartic equation . Like I said I'm using Ferrari's solution http://en.wikipedia.org/wiki/Quartic_function#Ferrari.27s_solution. But I'm under the impression that I need to take into account some sort of special case, to get rid of the incorrect roots that I'm calculating in certain cases.

5. Jun 4, 2010

### mathman

Many years ago I had to design a computer program involving solving a fourth degree equation. I found that they are serious precision related problems using Ferrari's method. I ended up using Sturm sequence and Newton's method (for real roots). This is much more robust.

6. Jun 4, 2010

### hotvette

Along the lines of mathman's comment, I noticed your stated problem had 16 significant digits for the coefficients. If that number of significant digits is important, then precision/roundoff might hurt you. I entered the numbers into Excel and it truncated the numbers (a handheld calculator would be worse).

You might try using extended precision with your program if you can.

7. Mar 2, 2011

hi
[K]-w2[M]=0

where:
K=[ 654.7 -327.35 0 0
-327.35 654.7 -327.35 0
0 -327.35 654.7 -327.35
0 0 -327.35 327.35]

and

M = [1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1]

then solve for w2

note : K - stiffness in matrix
M - mass in matrix also