Find Cubic Equation from Four Points?

2 replies · 6K views · last reply
dionwaiters
Messages
1
Reaction score
0
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.
 
Excel does that by the least squares method:

http://en.wikipedia.org/wiki/Least_squares

It reduces to the solution of a linear system.

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

http://en.wikipedia.org/wiki/Lagrange_polynomial

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
 
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.