Lagrange and cubic spline interpolate

In summary, this homework statement is unusual in that it asks for both interpolation methods to produce the same result, but then doesn't provide a clear explanation as to how this is happening.
  • #1
BearY
53
8

Homework Statement


This is a bit unusual, I don't know whether I should post it here or math forum tbh.
When I was doing numerical method home work, I am required to do perform both of these interpolation on a set of 4 data points. It turns out that the result of these 2 methods always agrees with each other(not proven in any way, just by playing with data, that's why I am asking). We were asked to explain this. I have not a clue how this is happening.

Homework Equations

The Attempt at a Solution


Since there are 4 data points, the Lagrange polynomial is also a cubic function. I have that to start with.
I also have the formula of how the cubic splines are piece-wise calculated. But then I am stuck here.
Is it because of the formula or there is a deeper reason?
 
Last edited:
Physics news on Phys.org
  • #2
BearY said:

Homework Statement


This is a bit unusual, I don't know whether I should post it here or math forum tbh.
When I was doing numerical method home work, I am required to do perform both of these interpolation on a set of 4 data points. It turns out that the result of these 2 methods always agrees with each other(not proven in any way, just by playing with data, that's why I am asking). We were asked to explain this. I have not a clue how this is happening.

Homework Equations

The Attempt at a Solution


Since there are 4 data points, the Lagrange polynomial is also a cubic function. I have that to start with.
I also have the formula of how the cubic splines are piece-wise calculated. But then I am stuck here.
Is it because of the formula or there is a deeper reason?
I think that is a good place to start. Show that both approaches produce the same equation for the dependent variable. You could do that by brute force, or you could show that the Lagrange polynomial solution satisfies all of the conditions of the cubic spline solution. (The second way is a lot easier.)
 
  • Like
Likes BearY
  • #3
tnich said:
I think that is a good place to start. Show that both approaches produce the same equation for the dependent variable. You could do that by brute force, or you could show that the Lagrange polynomial solution satisfies all of the conditions of the cubic spline solution. (The second way is a lot easier.)
From what I know, the only (three if count separately) condition is neighbor splines have same value of ##f, f', f''## at the joint. The deriving of spline formula is also solely based on these conditions if I am not mistaken. Since the Lagrange polynomial is a polynomial, it naturally fits these criteria. But does fitting these criteria plus having 4 intersections making the cubic function equivalent?
edit: Since we are starting from those conditions, plus MATLAB uses not a knot method, and reached a unique solution to the 2nd derivatives of the four data points, does that mean any cubic function that fits these condition will be equivalent?
 
Last edited:
  • #4
BearY said:
From what I know, the only (three if count separately) condition is neighbor splines have same value of ##f, f', f''## at the joint. The deriving of spline formula is also solely based on these conditions if I am not mistaken. Since the Lagrange polynomial is a polynomial, it naturally fits these criteria. But does fitting these criteria plus having 4 intersections making the cubic function equivalent?
I think you will need to show that the Lagrange polynomial solution fits the end conditions of the cubic spline, too. If the cubic spline solution is unique, and the (unique) Lagrange polynomial solution satisfies all of its conditions, then it must also be the unique cubic spline solution.
 
  • Like
Likes BearY
  • #5
tnich said:
I think that is a good place to start. Show that both approaches produce the same equation for the dependent variable. You could do that by brute force, or you could show that the Lagrange polynomial solution satisfies all of the conditions of the cubic spline solution. (The second way is a lot easier.)
tnich said:
I think you will need to show that the Lagrange polynomial solution fits the end conditions of the cubic spline, too. If the cubic spline solution is unique, and the (unique) Lagrange polynomial solution satisfies all of its conditions, then it must also be the unique cubic spline solution.
Yes I see now Thank you.
 
Last edited:

What is Lagrange interpolation and how does it work?

Lagrange interpolation is a mathematical method used to approximate a function based on a set of data points. It works by constructing a polynomial function that passes through all the given data points, thus creating a smooth curve that can be used to estimate values between the data points.

What is the purpose of using cubic spline interpolation?

Cubic spline interpolation is a more advanced form of interpolation that is used to approximate a function using piecewise third-degree polynomials. It is particularly useful when the data points are not evenly spaced or when there are abrupt changes in the data, as it can provide a smoother and more accurate estimation compared to other methods.

How do you choose the number of data points for Lagrange interpolation?

The number of data points needed for Lagrange interpolation depends on the degree of the polynomial being used. For a polynomial of degree n, at least n+1 data points are required to ensure a unique solution. However, using too many data points can lead to overfitting, so it is important to carefully select the number of points based on the complexity of the function being approximated.

What is the difference between Lagrange and cubic spline interpolation?

The main difference between Lagrange and cubic spline interpolation is the type of polynomial used. Lagrange interpolation uses a single polynomial to approximate the entire function, while cubic spline interpolation uses multiple piecewise polynomials to create a more accurate and smooth estimation. Additionally, cubic spline interpolation is better suited for non-uniformly distributed data points and can handle discontinuities in the data.

What are the limitations of using Lagrange and cubic spline interpolation?

One limitation of Lagrange interpolation is its sensitivity to the location of the data points, as small changes in their placement can significantly affect the resulting polynomial. For cubic spline interpolation, the limitation lies in the assumption that the function is smooth and continuous, which may not always be the case in real-world scenarios. Additionally, both methods may not accurately approximate functions with high degrees of complexity.

Similar threads

  • Calculus and Beyond Homework Help
Replies
8
Views
479
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
4
Views
845
  • Calculus and Beyond Homework Help
Replies
10
Views
764
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
Back
Top