Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

#1
July 22nd, 2003, 01:32 AM
 getbabs
Registered User

Join Date: Jul 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation 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
July 22nd, 2003, 09:59 AM
 Scorpions4ever
Banned ;)

Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,390
Time spent in forums: 1 Month 4 Weeks 1 Day 22 h 32 m 40 sec
Reputation Power: 4080

http://www.sosmath.com/algebra/fact...111/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 ).
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

#3
July 24th, 2003, 09:39 AM
 RoeckieTM
Junior Member

Join Date: Jul 2003
Location: Belgium
Posts: 16
Time spent in forums: < 1 sec
Reputation 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
July 25th, 2003, 01:48 AM
 getbabs
Registered User

Join Date: Jul 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation 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
July 25th, 2003, 01:47 PM
 Scorpions4ever
Banned ;)

Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,390
Time spent in forums: 1 Month 4 Weeks 1 Day 22 h 32 m 40 sec
Reputation Power: 4080
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/t...79113?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.

 Viewing: Dev Shed Forums > Programming Languages - More > Software Design > Logic to solve a Cubic Equation