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

In summary, determining a function from a table is easy when there is a clear pattern, but becomes more difficult when there is no pattern. Excel's LINEST function can be used to fit a polynomial to a set of points, but it may not provide a reasonable prediction for future points unless there is reason to believe the underlying data follows a polynomial pattern. An alternative method is Lagrange Interpolation, which involves finding a combination of linearly independent functions that match the known data points. This approach can be used for any number of data points.
  • #1
alext180
5
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
http://spreadsheetpage.com/index.php/tip/chart_trendline_formulas/

Excel can do up to 16th power. After that you're on your own :)
 
  • #6
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.
 
  • #7
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.
 
  • #9
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.
 

1. How do I determine the relationship between the inputs and outputs in an irregular table of values?

To determine the relationship between the inputs and outputs in an irregular table of values, you can plot the points on a graph and see if there is a pattern or trend. You can also try to find a common difference or ratio between the values to see if it follows a linear or exponential pattern.

2. What is the process for deriving a function from an irregular table of values?

The process for deriving a function from an irregular table of values involves identifying the pattern or trend in the data, determining the type of function that best fits the data (linear, quadratic, etc.), and using algebraic methods to find the equation of the function.

3. Can I use interpolation or extrapolation to find a function from an irregular table of values?

Yes, interpolation and extrapolation can be used to find a function from an irregular table of values. Interpolation involves using the known data points to estimate the value of the function at a point within the given range, while extrapolation involves using the known data points to estimate the value of the function at a point outside of the given range.

4. Are there any limitations to deriving a function from an irregular table of values?

Yes, there are limitations to deriving a function from an irregular table of values. The data points must follow a pattern or trend that can be represented by a mathematical function, and the function may only accurately represent the data within the given range of values.

5. Can I use a computer program to automatically derive a function from an irregular table of values?

Yes, there are many computer programs that can automatically derive a function from an irregular table of values. These programs use algorithms and regression techniques to find the best-fit function for the given data points. However, it is important to check the results and make sure they accurately represent the data before using the function for any calculations or predictions.

Similar threads

  • General Math
2
Replies
51
Views
2K
  • General Math
Replies
24
Views
2K
Replies
18
Views
2K
Replies
4
Views
749
Replies
5
Views
833
Replies
3
Views
453
Replies
2
Views
668
  • General Math
Replies
6
Views
1K
  • General Math
Replies
2
Views
2K
Back
Top