Take the 2-minute tour ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

I am a bit confused of the qualitative behavior of the two methods. Consider quadratic case, start by having points $x_i$, where I know the value and points $y_j$, where the values to be found. If I want to do Lagrange interpolation at any point $y_j$, I find three points from $x_i$ with values close by and fit the parabola between those three points with values $f(x_i)$. Once I have the parabola I estimate the value at the unknown point as a value of the parabola at that point. Since the polynomial is of second order I will match all the terms up to 2 in the Taylor expansion and locally will have $O(h^3)$ error.

On the other hand, for the Hermite cubic spline I fit the parabola between every two points keeping the derivatives equal at all nodes from both sides. Again, I expect the local error to be $O(h^3)$.

So, is there a difference between the two in the error? If so, why one would prefer one method to the other? Thanks!

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

The convergence order is the same. My gut feeling is that the magnitude of the error is going to be larger for the Hermite interpolation than for Lagrange interpolation, but the real reason why one would use the former is that you get an interpolation that is $C^1$, i.e., that is continuously differentiable. On the other hand, the Lagrange interpolation is only locally a quadratic polynomial but is not continuously differentiable at the nodes. There are situations where that is not enough and we really does need a continuously differentiable approximation of a function.

share|improve this answer
    
thanks. In fact, I have a number of grid points, so I am not trying to get a smooth curve as a result, I just want to get a good approximation at the number of points from the values of other points. So, I guess in that case it is certainly easier to do Lagrange as I don't need to solve a huge system with unknowns to get those coefficients for the splines. –  Kamil Nov 5 '12 at 3:11
2  
Yes. If you don't care about smoothness, then there is no point in using Hermite interpolation. –  Wolfgang Bangerth Nov 5 '12 at 3:56
    
One such example where Hermite is better than lagrange interpolation is collocation finite element method, since they require higher order continuity. –  Paul Nov 5 '12 at 5:06
    
@Paul not necessarily. The choice of whether to require continuity (and to what degree) is one of the things that defines your finite element method. –  David Ketcheson Nov 5 '12 at 5:11
    
@Medan: Cubic hermite splines do not need the solution of a large linear system. See the note at the end of my answer. –  Arnold Neumaier Nov 7 '12 at 8:50
add comment

Cubic Hermite interpolation requires different data (function value and derivative at two end points) than quadratic polynomial fit (three function values). Also, cubic Hermite interpolation fits a cubic to 4 dof, hence is order $O(h^4)$, while a quadratic polynomial fits 3 dof only, hence is order $O(h^3)$.

If a cubic polynomial were fitted by Lagrange (or Newton interpolation), the error would be $O(h^4)$ as for a cubic Hermite spline, but still the data used are different, so (unless the function interpolated is exactly cubic) the interpolants will typically be different.

If you have function values and derivative values at multiple points, cubic Hermite spline interpolation will typically be more robust than polynomial interpolation to the function values only by Lagrange. (You get higher order if your original function ishighly differentiable, but you could get even higher order if you'd use confluent newton interpolation through the hermite data.)

[Edit] Note that cubic Hermite splines do not need the solution of a large linear system. If you have the derivatives they are as easy to apply as Lagrange interpolation. To interpolate between two points $x_i$ and $x_{i+1}$, define $h:=x_{i+1}-x_i$ and get for $t\in[0,1]$ $$f(x_i+th)=(1-t)f_i+tf_{i+1}+ t(1-t)(u +tv),$$ where $u$ and $v$ determined by matching the derivatives at both end points. You get one order of accuracy higher than with quadratic Lagrange interpolation.

share|improve this answer
    
it is a nice explanation. Even though I actually meant quadratic splines(so that I compare apples to apples), but your argument still apply. I agree that I don't need to solve big systems but you still would have to find $u$ and $v$ from matching derivatives which ties you with another interval, thus it is not as local. For Lagrange, I just need three point to get an answer but for Hermite I would have to have all the points to solve for each interval $u$ and $v$. So to me it looks more favorable to use Lagrange if I construct a curve at the set of new points only. –  Kamil Nov 8 '12 at 2:16
    
@Medan: Three points needed for quadratic Lagrange are less local than two points and their derivatives for cubic Hermite splines. - You cannot fit a quadratic to two function values and two derivatives. - Computing $u$ and $v$ is a simple calculation that you do once on paper to find out which explicit formula to implement; if you count the number of operations compared to quadratic Lagrange you'll find little differences. –  Arnold Neumaier Nov 8 '12 at 9:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.