#1
  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. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    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 ).
    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

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. 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.
  6. #4
  7. 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.
  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    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.
    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

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo