1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Find Cubic Equation from Four Points?

  1. May 18, 2014 #1
    I am working on finding the area of a solid object. I have 4 points that I need to calculate a cubic equation from. I have tried relentlessly but to no avail I always get the wrong answer.

    The four points are;(0,2.7) (0.5, 2.9) (1,3.2) (1.9, 3.4)

    Using excel, the formula should be; -0.24728x^3 + 0.57093x^2 + 0.17636x + 2.7

    If anyone can provide working out on how you got the equation it would be much obliged! No matrices please just substitution.
  2. jcsd
  3. May 18, 2014 #2


    User Avatar
    Gold Member

    Excel does that by the least squares method:


    It reduces to the solution of a linear system.

    Another way to proceed for your specific problem is based on the Lagrange polynomials:


    This is a very simple method. It is applicable only because you have 4 data and 4 unknowns.
    In your case, this gives the following polynomial:

    P(x) =
    2.7 ((x-0.5)(x-1)(x-1.9)) / ((0-0.5)(0-1)(0-1.9)) +
    2.9 ((x-0)(x-1)(x-1.9)) / ((0.5-0)(0.5-1)(0.5-1.9)) +
    3.2 ((x-0)(x-0.5)(x-1.9)) / ((1-0)(1-0.5)(1-1.9)) +
    3.4 ((x-0)(x-0.5)(x-1)) / ((1.9-0)(1.9-0.5)(1.9-1))

    (32319 + 2111 x + 6834 x^2 - 2960 x^3)/11970
  4. May 18, 2014 #3


    User Avatar
    Science Advisor

    Here's another way to do that: a cubic function can be written in the form [itex]y= ax^3+ bx^2+ cx+ d[/itex] and determining the function means determining the four values of a, b, c, and d. Setting x and y equal to their values in those four points gives four equations:
    [itex]d= 2.7[/itex]
    [itex]0.125a+ .25b+ .5c+ d= 2.9[/itex]
    [itex]a+ b+ c+ d= 32[/itex]
    [itex]6.859a+ 3.61b+ 1.9c+ d= 3.4[/itex]

    Solve those equations for a, b, c, and d.

    maajdl's "Lagrange polynomial" is simpler. But "least squares" is a method for fitting a curve closest to a larger number of points that you cannot get a single curve pass through. It would be appropriate if we had more than four points we wanted to fit a cubic to.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook