### Thread: Logic to solve a Cubic Equation

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Jul 2003
Posts
4
Rep Power
0

#### Logic to solve a Cubic Equation

Hi All,

I have a cubic equation

Y = a+ bx+ cx**2+dx**3

where Y,a,b,c,d are constants (known values).

I need to find the value of x.

Could anybody help me out with a logic??

2. When in doubt, Google:

http://www.sosmath.com/algebra/facto...11/fac111.html
http://mathworld.wolfram.com/CubicEquation.html

IIRC, there are published analytic solutions for equations up to the 7th power. For higher powers, you could always use an approximation technique like Newton Raphson method, where you run the equations multiple times to converge on a solution. (Now I'm getting flashbacks of my numerical methods classes ).
3. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Jul 2003
Location
Belgium
Posts
16
Rep Power
0
Just like Scorpions4ever (what a name btw pointed out: the solution for this (mathematical) "problem" already exists. You just have to write code to implement it.
4. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Jul 2003
Posts
4
Rep Power
0

#### Looking for an Implemented Code

Hi All,

I am aware that there are solutions to solve cubic equations. But i am looking for an implemented code.
5. You haven't specified the language you're intending to use, but if I recall correctly, the books Numerical Recipes in C and Numerical Recipes in Fortran both had the routines. http://www.amazon.com/exec/obidos/tg...9113?vi=glance

I guess you could check out the book in your local bookstore to verify that the code is there or not.

Also http://www.nr.com/ has all the code from the books available online.