Skip to main content
GameDev.net gamedev.net
🔒 Locked

3rd order polynom

Started by The C modest god Jun 12, 2006 at 10:52 AM 2 replies 1k views
Original Post
The C modest god
The C modest god
Is there a formula for a order 3 polynom roots? Specifically, I need to find the roots of: X^3-X-Y=0 Where Y is a parameter. How do I do this? Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
alvaro
alvaro
Here is one way, which works once you don't have a term in X^2. Introduce two new variables U and V such that U+V = X (notice that there are many possible values of U and V, so we will be able to impose one arbitrary restriction on them later on).

(U+V)^3-(U+V)-Y=0
U^3+3U^2V+3UV^2+V^3-(U+V)-Y=0
U^3+V^3+(U+V)(3UV)-(U+V)-Y=0
U^3+V^3-Y+(U+V)(3UV-1)=0
Now we will impose the arbitrary condition that U^3+V^3-Y is 0. Now we have a system of equations to solve:

U^3+V^3=Y
UV=1/3

We can raise the last equation to the third power, to get
U^3+V^3=Y
U^3V^3=1/27
So U^3 and V^3 are two numbers of which we know he sum and the product. We can find them by solving the auxiliary equation (w-U^3)(w-V^3)=0, which is w^2-(U^3+V^3)w+U^3V^3=0, which is w^2-Yw+1/27=0.

The solutions to the auxiliary equation are w1=(Y+sqrt(Y^2-4/27))/2 and w2=(Y-sqrt(Y^2-4/27))/2.

We can recover U and V by taking cubic roots carefully, because a number has three cubic roots. When we do that, all the solutions to the original equation are
x1 = w1^(1/3)+w2^(1/3)
x2 = G*w1^(1/3)+G^2*w2^(1/3)
x3 = G^2*w1^(1/3)+G*w2^(1/3)
where G is the complex number (-1+sqrt(3)i)/2.

A probably better explanation can be found here: http://en.wikipedia.org/wiki/Cubic_equation

[Edited by - alvaro on June 12, 2006 11:13:05 AM]
The C modest god
The C modest god
But for certain Ys there should be 3 real solutions?
Is that the case in the solution you presented?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower. Quote: Original post by Toolmaker Quote:
alvaro
alvaro
Quote:
Original post by The C modest god
But for certain Ys there should be 3 real solutions?
Is that the case in the solution you presented?

Yes. In the cases where all the roots are real all the imaginary terms will cancel out. Why don't you try to follow the solution I gave with an example? I think you should start with a specific value of Y and try to solve that. Pick one for which there are three real roots if you want.

You can also find a step-by-step method here: http://www.1728.com/cubic2.htm. You didn't look very hard before you asked here, did you?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.