# Interpolating Lagrange curve

*Interpolating curves* are designed to run through all given points.
The Bezier curve, for instance, goes through its endpoints only,
because at the parameter values corresponding to the endpoints (*t =0,
t = 1*) all the basis functions are zero except the first and last, which
are one. Thus **P**(0) = **P**_{0} and
**P**(1) = **P**_{n} are exactly the control points.
In order to get Lagrange interpolating curve

**P**(t) = ∑_{i=0,n}
L_{i}^{n}(t) **P**_{i} (*)

the *i*-th basis function at some parameter
*t*_{i} must be one, and all others must be zero.
This particular value of the parameter *t* is associated with
each interpolating point **P**_{i} and is called *knot*.
*Lagrange polynomials* will give the interpolation property for all points:

*L*_{i}^{n}(t) =
(t - t_{0 })(t - t_{1 })...
(t - t_{i-1 })(t - t_{i+1 })...(t - t_{n }) /
(t_{i} - t_{0 })(t_{i} - t_{1 })...
(t_{i} - t_{i-1 })(t_{i} - t_{i+1 })...
(t_{i} - t_{n })

L_{i}^{n}(t_{i }) = 1,
L_{i}^{n}(t_{k }) = 0.

## Quadratic Lagrange curve

*Interactive Lagrange curve* Use finger or mouse to move nearest control
point (a small blue square to the left) or knot (a black square to the right).
In the right applet window you see basis Lagrange polynomials.
Move a knot to see how it influences on spline shape and basis functions.
Images are fitted to your browser window.
## Cubic Lagrange curve

Note that Lagrange curves are not contained in the convex hull
of its control points.
## Aitken algorithm

The analogue of the de Casteljau algorithm in the case of Lagrange curves
is the *Aitken algorithm*

**P**_{i}^{j} =
**P**_{i}^{j-1}
(t_{i+j} - t) / (t_{i+j} - t_{i }) +
**P**_{i+1}^{j-1}
(t - t_{i }) / (t_{i+j} - t_{i }) ,
j = 1, n i = 0, n - j .

However formula (*) and stored array of basis functions are used in
lagrange.js. These polynomials were calculated
earlier for the right window as
for (i = 0; i < N; i++){
P = 1;
for (j = 0; j < N; j++)
if (j != i) P = P*(t-ti[j])/(ti[i] - ti[j]);
}

## Oscillations of Lagrange curves

As Lagrange polynomials oscillate between its roots (knots), therefore
they can take negative values. Unfortunately these oscillations grow quickly
with *n* increasing. You see below these oscillations in an interpolating
curve of *n = 7* degree. Compare Lagrange and Bezier (lower picture)
curves too.

Therefore Lagrange interpolation is useless for complex curves with
large *n* values. But further we will compose an interpolating spline
of cubic Bezier segments joined smoothly.

Contents
Previous: More Bezier splines Math
Next: Interpolating Cardinal splines

*updated* 24 June 2001