0% found this document useful (0 votes)
2K views8 pages

Lagrange Polynomial: y (X) A X X X X X X X X X X X X

The Lagrange polynomial allows approximating a function with discrete data points without solving a system of equations, as it expresses the polynomial as a linear combination of basis polynomials. Cubic splines fit piecewise cubic polynomials to data points and ensure continuity of the first and second derivatives at points, providing a smooth interpolation. The coefficients of the cubic polynomials are determined by solving a tridiagonal system of equations using numerical techniques like Thomas algorithm. Polynomials of degree higher than 3 are rarely used for approximation due to errors with large datasets.

Uploaded by

John Five
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views8 pages

Lagrange Polynomial: y (X) A X X X X X X X X X X X X

The Lagrange polynomial allows approximating a function with discrete data points without solving a system of equations, as it expresses the polynomial as a linear combination of basis polynomials. Cubic splines fit piecewise cubic polynomials to data points and ensure continuity of the first and second derivatives at points, providing a smooth interpolation. The coefficients of the cubic polynomials are determined by solving a tridiagonal system of equations using numerical techniques like Thomas algorithm. Polynomials of degree higher than 3 are rarely used for approximation due to errors with large datasets.

Uploaded by

John Five
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lagrange Polynomial

y(x) = a0 ( x x1 )( x x 2 ) + a1 ( x x 0 )( x x 2 ) + a2 ( x x 0 )( x x1 )
y0
a0 =
(x0 x1 )(x0 x2 )
y1
a1 =
(x1 x0 )(x1 x2 )
a2 =

y2

% xx (
j
y(x) = y i ''
**
j= 0& x i x j )
i= 0
ji
n

(x2 x0 )(x2 x1 )

The method avoids solving a system of (n+1) equations as

polynomial approach.
required in the standard

Programming is easy.
Polynomials of degree greater than 2 or 3 generally not used.

Important Notes about


Approximating Function
1.

The degree of the approximating polynomial is


determined by the number of data points. A large data
set would then require a polynomial of very high degree.
This will generally entail significant errors.

2.

Typically polynomials of more than 3th or 4th degree are


seldom used. Then a large dataset is divided into smaller
subsets,and a lower-order polynomial is used for each
subset. A cubic spline is commonly used in this context.

3.

In special cases, other approximating functions such as


exponential and sinusoidal functions may be preferable
compared to polynomial function.

Cubic Splines and Numerical


Interpolation
Fi ( x ) = ai (x x i ) 3 + bi (x x i ) 2 + c i (x x i ) + di
F(x)

Cubic Spline Fit


High-Degree Polynomial

x i x x i+1

Cubic Splines and Numerical


Interpolation
Fi ( x ) = ai (x x i ) 3 + bi (x x i ) 2 + c i (x x i ) + di

x i x x i+1

F(xi)
Fi-1

Fi

g(x)

F(xi)

hi-1
x0

x1

xi-1

hi
xi

xi+1

xn

Cubic Splines and Numerical


Interpolation
Fi ( x ) = ai (x x i ) 3 + bi (x x i ) 2 + c i (x x i ) + di

x i x x i+1

Using values at x = xi and x = xi+1

di = f i

(1)

f i+1 = ai hi3 + bi hi2 + c i hi + f i

(2)

hi = x i+1 x i

Write the first and second derivatives of Fi

Fi"( x ) = 3ai (x x i ) 2 + 2bi (x x i ) + c i

Si = 2bi

(3)

" (x) = 6ai (x x i ) + 2bi


Fi"

Si+1 = 6ai hi + 2bi

(4)

Then (1), (2), (3), and (4) provide


the necessary equations

to obtain ai, bi, ci,and di

Cubic Splines and Numerical Interpolation


Solving these equations yields
Si+1 Si
ai =
6hi

Si
bi =
2

fi+1 fi hi
ci =
(2Si + Si+1 )
hi
6

di = f i

Si and Si+1 are determined by using the condition that the slopes of
the two curves (Fi and Fi-1 ) joining at point (xi, fi ) be
the same.

Fi"( x i ) =c i

" ( x ) = 3ai1 (x x i1 ) 2 + 2bi1 (x x i1 ) + c i1


Fi1

" ( x i ) = 3ai1hi12 + 2bi1hi1 + c i1 = Fi"( x i ) = c i


Fi1
Si Si1

ai1 =
6hi1

S
bi1 = i1
2

ci1 =

fi fi1 hi1

(2Si1 + Si )
hi1
6

di1 = f i1

Substituting for ci, ai-1, bi-1, ci-1 ,above yields a tridiagonal system,
which can be solved to obtain Si.

Cubic Splines and Numerical Interpolation


# f i+1 f i f i f i1 &
hi1Si1 + 2(hi + hi1) Si + hi Si+1 = 6%

( , i =1,2..,n -1
hi1 '
$ hi

This gives (n-1) equations for (n+1) values of the unknown S.


Two additional equations are obtained assuming (1) S0= Sn =0
or (2) S0= S1 and Sn= Sn-1 .
The above tridigonal system can be easily solved using
Thomas algorithm (Gaussian elimination). Then the
coefficients ai, bi, ci can be computed, providing the cubic
splines for the entire dataset.
The cubic splines can be used for interpolation as needed.
Many graphing software employ cubic splines for curve fitting
and interpolation.

Cubic Splines and Numerical Interpolation


# f i+1 f i f i f i1 &
hi1Si1 + 2(hi + hi1) Si + hi Si+1 = 6%

( , i =1,2..,n -1
hi1 '
$ hi
S(x)

S(x0) = 0

x0

xi-2

Example

xi-1

xi

xi+1

xi+2

xn

You might also like