0% found this document useful (0 votes)
176 views9 pages

Lectures Part - 3 (Lagrange Method)

This document discusses the Lagrange method of interpolation. It begins by defining interpolation as finding the value of 'y' at a value of 'x' that is not given, given a set of (x,y) data points. It then states that polynomials are commonly used as interpolants because they are easy to evaluate, differentiate, and integrate. The document goes on to define the Lagrangian interpolating polynomial formula, which approximates a function using a polynomial that passes through the given data points. It provides an example of using this method to find the value of log10(301). Finally, it provides another example of using a quadratic Lagrange interpolating polynomial to find the value of ln(2.7).
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)
176 views9 pages

Lectures Part - 3 (Lagrange Method)

This document discusses the Lagrange method of interpolation. It begins by defining interpolation as finding the value of 'y' at a value of 'x' that is not given, given a set of (x,y) data points. It then states that polynomials are commonly used as interpolants because they are easy to evaluate, differentiate, and integrate. The document goes on to define the Lagrangian interpolating polynomial formula, which approximates a function using a polynomial that passes through the given data points. It provides an example of using this method to find the value of log10(301). Finally, it provides another example of using a quadratic Lagrange interpolating polynomial to find the value of ln(2.7).
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/ 9

Lagrange Method of

Interpolation
What is Interpolation ?
Given (x0,y0), (x1,y1), …… (xn,yn), find the
value of ‘y’ at a value of ‘x’ that is not given.

2 http://numericalmethods.eng.usf.edu
Interpolants
Polynomials are the most common
choice of interpolants because they
are easy to:

Evaluate
Differentiate, and
Integrate.

3 http://numericalmethods.eng.usf.edu
Lagrangian Interpolation
Lagrangian interpolating polynomial is given by
n
f n ( x)   Li ( x) f ( xi )
i 0

where ‘ n ’ in f n (x) stands for the n th order polynomial that approximates the function y  f (x)

given at (n  1) data points as  x0 , y 0 , x1 , y1 ,......,  x n 1 , y n 1 ,  x n , y n  , and


n x  xj
Li ( x)  
j 0 xi  x j
j i

Li (x) is a weighting function that includes a product of (n  1) terms with terms of j  i


omitted.

4 http://numericalmethods.eng.usf.edu
Example-1
Certain corresponding values of x and log10 x are

xi f(xi)
Form formula
300
300, 2.4771 ,
2.4771

304 2.4829

305 2.4843
307 2.4871

Find the value of log10 301

Ln  x  
 x  x1  x  x2 ....... x  xn 
y0 
 x  x0  x  x2 ....... x  xn 
y1  ........
 x0  x1  x0  x2 ........ x0  xn   x1  x0  x1  x2 ........ x1  xn 
 301  304  301  305  301  307   301  300 301  305 301  307 
log10 301   2.4771   2.4829 
300  304300  305300  307  304  300 304  305304  307 
301  300301  304 301  307  2.4843  301  300 301  304 301  305  2.4871
    
305  300305  304 305  307  307  300 307  304 307  305 

 3 4  6  1 4  6 
log10 301   2.4771   2.4829 
 4  5 7   4  1 3
1 3 6  1 3 4 
  2.4843   2.4871
 51 2   7  3 2 

 1.2739  4.9658  4.4717  0.7106

 2.4786

6
Example-2
Find the Lagrange interpolating polynomial of degree 2
approximating the function y  ln x defined by the following
table of values. 2 0.69315
2.5 0.91629
3.0 1.09861

Hence determine the value of ln 2.7 .


We have  x  2.5 x  3.0
l0  x    2 x 2  11x  15
 0.5 1.0
Similarly, we find
l1  x     4 x 2  20 x  24 
and
l2  x   2 x 2  9 x  10
Hence
L2  x    2 x 2  11x  15  0.69315   4 x 2  20 x  24   0.91629 
  2 x 2  9 x  10  1.09861

 0.08164 x2  0.81366 x  0.60761

Which is required quadratic polynomial.

Putting x  2.7, in the above polynomial, we obtain

ln 2.7  L2  2.7   0.08164  2.7   0.81366  2.7   0.60761  0.9941164


2

Actual value of ln 2.7  0.9932518, so that


Error  0.0008646
Program for Lagrange’s Method
Dimension p(50),x(50),f(50)
open(unit=5,file='lagr.in',status='unknown')
open(unit=6,file='lagr.res',status='unknown')
read(5,100)n,xx
Write(6,100)n,xx
read(5,101)(x(i),f(i),i=1,n)
write(6,101)(x(i),f(i),i=1,n)
100 format(I5, f10.4)
101 format(2f10.4)
Do 10 j=1,n
P(j)=1.0
Do 11 i=1,n
If(i-j)5,11,5
5 P(j)=p(j)*((xx-x(i))/(x(j)-x(i)))
11 continue
10 continue
Sum=0.0
Do 15 k=1,n
Sum=sum+p(k)*f(k)
15 continue
Write(6,102)xx,sum
102 format(2e13.4)
close(unit=6)
close(unit=5)
Stop
end

You might also like