Possible function y=f(x) if data points are given.

In summary, the conversation discusses the use of Lagrange's method for interpolating polynomials and how it involves calculating multiple terms and adding them together to get the desired polynomial. The specific example given is for a three-point interpolation, but the method can be applied to any number of data points. The conversation also mentions the possibility of using a linear algebra approach to solve for the polynomial.
  • #1
s0ft
83
0
How could one obtain a function [itex]y=f(x)[/itex] that satisfies a number of data points [itex](x_{i},y_{i})[/itex]. That is how would it be possible to get a function if some points that are to lie on it have been given? I've seen some lectures on interpolation but all I've gotten is only the way to solve problems, not the exact 'why' or 'how' these tecnhiques work.
Things like direct interpolation are straightforward but Lagrange's method, Newton's Divided Difference etc are the things I'm talking about.
 
Mathematics news on Phys.org
  • #2
Let's take Lagrange's Method for interpolating polynomials.
What are we after? A polynomial of degree N that at (N+1) Points yields the prescribed y-values.

Let us think as follows:
If our polynomial consists of N+1 TERMS, each term having the property that they are Equal to zero at N of the prescribed Points, and Equal to a prescribed y-value, then it is easy to construct the Whole polynomial.

Suppose N=2
By Construction, we get p(x) easily as:
[tex]p(x)=\frac{(x-x_{2})(x-x_{3})}{(x_{1}-x_{2})(x_{1}-x_{3})}y_{1}+\frac{(x-x_{1})(x-x_{3})}{(x_{2}-x_{1})(x_{2}-x_{3})}y_{2}+\frac{(x-x_{1})(x-x_{2})}{(x_{3}-x_{1})(x_{3}-x_{2})}y_{3}[/tex]

If you focus on what each term here actually does, it is simple to generate the similar polynomials for other degrees of N
 
  • #3
arildno said:
[tex]p(x)=\frac{(x-x_{2})(x-x_{3})}{(x_{1}-x_{2})(x_{1}-x_{3})}y_{1}+\frac{(x-x_{1})(x-x_{3})}{(x_{2}-x_{1})(x_{2}-x_{3})}y_{2}+\frac{(x-x_{1})(x-x_{2})}{(x_{3}-x_{1})(x_{3}-x_{2})}y_{3}[/tex]
Yes, I don't understand how that expression comes.
 
  • #4
Hey s0ft.

You might want to consider a linear algebra version of the problem and then derive the inverse matrix.

Remember that if you are solving for a polynomial with n points, you will have n linearly independent equations to solve.
 
  • #5
s0ft said:
Yes, I don't understand how that expression comes.
More generally, Lagrange's method for a n- 1 polynomial interpolating n given data points, [itex](x_i, y_i)[/itex], requires calculating n terms
[tex]\frac{(x- x_1)(x- x_2)\cdot\cdot\cdot(x-x_{i-1})(x- x_{i+1}\cdot\cdot\cdot(x- x_{n-1})(x- x_n)}{x_i- x_1)(x_i- x_2)\cdot\cdot\cdot(x_i- x_{i- 1})(x_i- x_{i+1}\cdot\cdot\cdot(x_i- x_{n-1})(x- x_n)}y_i[/tex]
with i from 1 to n, and adding them.

Look closely at that fraction. The numerator has the variable "x" minus each [itex]x_j[/itex] except the ith one. The denominator then has that [itex]x_i[/itex] minus each of the other [itex]x_j[/itex]. For x equal to each [itex]x_j[/itex] except [itex]x_i[/itex] that fraction will be 0 because there will be a factor of 0 in the numerator. For [itex]x= x_i[/itex] that fraction will be 1 because each factor in the numerator has an identical factor in the denominator.

That means that at [itex]x= x_i[/itex] will will have [itex]y_i[/itex] times 1 and all other y values times 0.

In the three point example arildno gave,
[tex]\frac{(x- x_2)(x- x_3)}{(x_1- x_2)(x_1- x_3)}y_1+ \frac{(x- x_1)(x- x_3)}{(x_2- x_1)(x_2- x_3)}y_2+ \frac{(x- x_1)(x- x_2)}{(x_3- x_1)(x_3- x_2)}y_3[/tex]
when [itex]x= x_1[/itex], the second and third fractions are 0 because of the [itex]x_1- x_1[/itex] in the numerator while the first fraction is
[tex]\frac{x_1- x_2)(x_1- x_3)}{(x_1- x_2)(x_1- x_3)}y_1= y_1[/tex]
and similarly for [itex]x= x_2[/itex] and [itex]x= x_3[/itex].
 
  • #6
HallsOfIvy, probably you are thinking I know the general expression and presenting an explanation as to how what arildno posted came. Thank you for your effort but if I understood you correctly, it is the most general expression for the Lagrange's polynomial whose derivation I'm after.
 

1. What is the purpose of determining a function y=f(x) if data points are given?

The purpose of determining a function y=f(x) from given data points is to find a mathematical relationship between the independent variable x and the dependent variable y. This relationship can then be used to make predictions and analyze the behavior of the variables.

2. How do you determine the function y=f(x) from a set of data points?

To determine the function y=f(x) from a set of data points, you can plot the points on a graph and look for a pattern or trend. This can help you determine the type of function that fits the data, such as linear, quadratic, or exponential. You can also use regression analysis or other mathematical techniques to find the best fit for the data.

3. Can a set of data points have more than one possible function y=f(x)?

Yes, a set of data points can have multiple possible functions y=f(x). This is because there can be different mathematical relationships between the variables that can fit the data equally well. In this case, it is important to consider other factors, such as the context of the data, to determine the most appropriate function.

4. How accurate is the function y=f(x) determined from a set of data points?

The accuracy of the function y=f(x) determined from a set of data points depends on the quality and quantity of the data. With a larger and more representative data set, the function can be more accurate in predicting the behavior of the variables. However, it is important to note that there can still be errors and limitations in the function, especially if the data is not a perfect representation of the variables.

5. What are the limitations of determining a function y=f(x) from a set of data points?

There are several limitations to determining a function y=f(x) from a set of data points. One limitation is that the function may not accurately represent the true relationship between the variables, especially if the data is not a good representation or if there are outliers. Another limitation is that the function is only valid within the range of the given data and may not accurately predict values outside of this range. Additionally, the function may not take into account other factors that could affect the variables.

Similar threads

Replies
4
Views
1K
Replies
5
Views
845
Replies
3
Views
953
  • Programming and Computer Science
Replies
3
Views
352
Replies
1
Views
832
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
896
  • General Math
Replies
19
Views
1K
Replies
2
Views
1K
  • General Math
Replies
2
Views
2K
Replies
7
Views
1K
Back
Top