• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Solving x^3+a*x^2+b*x+c=0

Status
Not open for further replies.
Level 19
Joined
Feb 4, 2009
Messages
1,313
I wanted to solve an equatation of the form

x^3+a*x^2+b*x+c = 0
where a, b, c were given

and I had the following idea:

(x+d)*(x+e)*(x+f) = 0
(x^2 + d*x + e*x + d*e)*(x+f) = 0
x^3 + d*x^2 + e*x^2 + d*e*x + f*x^2 + d*f*x + e*f*x + d*e*f = 0
x^3 + (d*x^2 + e*x^2 + f*x^2) + (d*e*x + d*f*x + e*f*x) + d*e*f = 0
x^3 + (d+e+f)*x^2 + (d*e+d*f+e*f)*x + d*e*f = 0

a = d + e + f
b = d*e + d*f + e*f
c = d*e*f

So I got 3 equatations with 3 unknown variables so it should be possible to solve this
I tried to do it and after filling a few pieces of paper with formulars I surrendered
According to http://www.wolframalpha.com/input/?i=a+%3D+d%2Be%2Bf%2C+b+%3D+d*e%2Bd*f%2Be*f%2C+c+%3D+d*e*f
the equatation is rather complicated and I am too lazy to write it down

Can anyone post a simple step-by-step solution to this?

I require it for some complicated projectile movement
 
Last edited:
Level 7
Joined
Jul 18, 2009
Messages
272
Search google for the term "cubic equation" and you will find tons of stuff about this function.
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
If you want to solve it over the rationals, you can just brute force solutions using Descarte's rational root theorem.

Otherwise, google it. I remember how to solve one of the form: x3 + ax = b, but none with the quadratic term. Just google it lol.
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
If you're looking for the solution to that, you're essentially looking for solutions to a cubic equation, and as you've noticed, those tend to be pretty bulky unless if you make clever substitutions.

You don't always get simple solutions when you have a system of 3 equations and 3 variables (you might be thinking of a system of linear equations, and this is not that kind of a system).

There are several solutions on the wikipedia page on cubic equations.
 
Level 11
Joined
Dec 31, 2007
Messages
780
so far you have this

x^3 + d*x^2+e*x^2+f*x^2 + d*e*x+d*f*x+e*f*x + d*e*f = 0

which can be written like:

x^3+x^2*(d*e*f)+(x*e*f+x*d*f+x*d*e)
x^3+x^2*(d*e*f)+x*(e*f+d*f+d*e)

now we have x in every term, common factor

x(x^2+x*(d*e*f)+(e*f+d*f+d*e)) = 0

Now, if we want a multiplication to be = 0 either one of those factors have to be 0
In case x = 0 you already have a result and we have to work out this

x^2+x*(d*e*f)+(e*f+d*f+d*e)=0

so far this is getting kinda hard and I'm at work xD (If not solved 'till tonight i'll try later

EDIT:

Continue

now we have 3 terms
x^2
x*(d*e*f)
(e*f+d*f+d*e)

we can use this formula

(-b+-(b^2-4*a*c)^1/2)/2*a

which will result in

-(d*e*f)+-(def)^2-(4*1*(e*f+d*f+d*e))^1/2)/(2*1) = 0

(2*1)*0 = 0

then

-(d*e*f)+-(d*e*f)^2-(4*(e*f+d*f+d*e))^1/2) = 0

+-(d*e*f)^2-(4*(e*f+d*f+d*e))^1/2 = (d*e*f)

sqrt to pow

(d*e*f)^2)-(4*(e*f+d*f+d*e)) = (d*e*f)^2

now we have this

-4*(e*f+d*f+d*e) = 1

we have 2 terms multiplying

-4

e*f+d*f+d*e

I'm gonna try to do magic from here xD
 
Last edited:
Level 20
Joined
Apr 22, 2007
Messages
1,960
Nah you made mistakes. There is no way to solve this quickly without making clever substitutions, and clever people came up with clever substitutions which are documented on wikipedia. Just look it up, and I'd advise everyone else to stop trying, because it's pretty hard.
 
Status
Not open for further replies.
Top