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

  • Context: Undergrad 
  • Thread starter Thread starter alext180
  • Start date Start date
  • Tags Tags
    Derive Function Table
Click For Summary

Discussion Overview

The discussion revolves around deriving a function from an irregular table of values, specifically focusing on how to fit a polynomial to a set of data points that do not follow a clear pattern. Participants explore methods for obtaining a function that accurately represents the given values.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants note that deriving a function from a table with irregular values is challenging, as the points do not form a recognizable pattern.
  • One participant suggests fitting a 6th degree polynomial to the points, mentioning the use of the LINEST function in Excel.
  • Another participant expresses uncertainty about the results obtained from Excel, indicating a potential misunderstanding of how to use the software.
  • It is proposed that a 6th degree polynomial may not provide reliable predictions for values outside the given data points unless there is a belief that the data originates from such a polynomial.
  • A specific polynomial expression is presented as a potential solution, along with a reference to Lagrange Interpolation as a method for deriving the polynomial.
  • Participants discuss the concept of using multiple functions to create a combination that fits the data points, emphasizing the need for linear independence among the functions used.
  • One participant clarifies that the Excel function employs a least squares approach when the number of data points exceeds the polynomial degree.

Areas of Agreement / Disagreement

Participants express differing views on the reliability of fitting a polynomial to irregular data points. There is no consensus on the best approach to derive a function from the given values, and multiple methods are discussed without resolution.

Contextual Notes

Participants highlight the limitations of polynomial fitting, particularly regarding the assumptions about the underlying data and the potential for overfitting when using high-degree polynomials.

alext180
Messages
5
Reaction score
0
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.
 
Mathematics news on Phys.org
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.
 
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.
 
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.
 
http://spreadsheetpage.com/index.php/tip/chart_trendline_formulas/

Excel can do up to 16th power. After that you're on your own :)
 
alext180 said:
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.
 
jbriggs444 said:
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.
 
  • Like
Likes   Reactions: 1 person
MarneMath said:
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/LagrangeInterpolatingPolynomial.html
Wow! That's exactly what I was looking for... Although I don't quite understand Lagrange Interpolation. Thanks!
 
  • #10
alext180 said:
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.
 
Last edited:
  • #11
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.
 

Similar threads

  • · Replies 51 ·
2
Replies
51
Views
4K
  • · Replies 24 ·
Replies
24
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 18 ·
Replies
18
Views
5K