How to derive a function from an irregular table of values?

by alext180
Tags: derive, function, irregular, table, values
 P: 5 It's easy to get a function from a table that follows a clear pattern, but what if the values for y (or x) don't follow a pattern? For example; x = 1 , y = 13 x = 2 , y = 9 x = 3 , y = 3 x = 4 , y = 8 x = 5 , y = 1 x = 6 , y = 5 x = 7 , y = 12 If you look at these points on a graph, they don't make any normal line.
 P: 561 You should be able to fit a 6th degree polynomial that goes through all those points. You can do this using the LINEST function in Excel.
 P: 5 I put the values into excel and did =LINEST(A2:A8,B2:B8,,FALSE) and it gave me -0.464285714 as the slope and 9.142857 as the y-intercept but that can't be right, so I must have done something wrong... I'm not great with excel.
 P: 561 How to derive a function from an irregular table of values? Yes, you want a 6th degree polynomial not a one degree polynomial: ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g You will probably need to research to figure out how to get Excel to do this for you.
 P: 439 http://spreadsheetpage.com/index.php...line_formulas/ Excel can do up to 16th power. After that you're on your own :)
P: 996
 Quote by alext180 It's easy to get a function from a table that follows a clear pattern, but what if the values for y (or x) don't follow a pattern?
If the points do not have a pattern then a function that you determine by fitting it to match those seven points will not have much pattern either. Getting Excel to give you a degree six polynomial that passes through seven points will not give you a reasonable prediction for the eighth...

...unless you have reason to believe that the underlying data is not random and actually came from a sixth degree polynomial in the first place.
P: 5
 Quote by jbriggs444 If the points do not have a pattern then a function that you determine by fitting it to match those seven points will not have much pattern either. Getting Excel to give you a degree six polynomial that passes through seven points will not give you a reasonable prediction for the eighth... ...unless you have reason to believe that the underlying data is not random and actually came from a sixth degree polynomial in the first place.
You're right, but I think what I'm looking for is an equation that will equal the values of y when you plug in the corresponding values of x. Plugging in 1 will give you 13, 2 will give you 9, and so on :P.
 P: 439 So what you're looking for is this right? $$-\frac{53}{240}x^6+\frac{1277}{240}x^5-\frac{2419}{48}x^4+\frac{3801}{16}x^3-\frac{34733}{60}x^2+\frac{40477}{60}x-275$$ Have you tried Lagrange Interpolation? http://mathworld.wolfram.com/Lagrang...olynomial.html
P: 5
 Quote by MarneMath So what you're looking for is this right? $$-\frac{53}{240}x^6+\frac{1277}{240}x^5-\frac{2419}{48}x^4+\frac{3801}{16}x^3-\frac{34733}{60}x^2+\frac{40477}{60}x-275$$ Have you tried Lagrange Interpolation? http://mathworld.wolfram.com/Lagrang...olynomial.html
Wow! That's exactly what I was looking for... Although I don't quite understand Lagrange Interpolation. Thanks!
P: 996
 Quote by alext180 Wow! That's exactly what I was looking for... Although I don't quite understand Lagrange Interpolation. Thanks!
One way to think about it is that you have seven known values -- your data points. Now find seven different functions that have values at each of those data points. You need to pick functions that are linearly independent. That is, no one function can turn out to match any sum of multiples of the other functions.

Call the functions f1, f2, f3, f4, f5, f6 and f7.

You want to put together a combination k1f1 + k2f2 + k3f3 + k4f4 + k5f5 + k6f6 + k7f7 such that the combination has the right values at each of your seven data points. You can find the right combination by solving a set of seven simultaneous equations in seven unknowns. Say your data points are (x1,y1) through (x7,y7)

Then the equations are:

y1 = k1f1(x1) + k2f2(x1) + ... + k7f7(x1)
y2 = k1f1(x2) + k2f2(x2) + ... + k7f7(x2)
[...]
y7 = k1f1(x7) + k2f2(x7) + ... + k7f7(x7)

You know all the x's and y's. Those are your data points. You know the values for each of the functions at each of the x's. That's just a matter of evaluating each function at each point. The k values are the unknowns. Solve for for k1 through k7

Lagrange Interpolation is what you get if you take f1 through f7 to be:

f1(x) = 1
f2(x) = x
f3(x) = x2
...
fn(x) = xn-1

[Edit, fixed error on the final exponent above]

Obviously this will work for any number of data points, not just seven.
 P: 561 That is what the excel function is doing except it does a least squares approach for the case where the number of data points exceeds the degree of the polynomial by one or more.

 Related Discussions General Math 1 Precalculus Mathematics Homework 2 Calculus & Beyond Homework 1 Advanced Physics Homework 1 Calculus & Beyond Homework 16