Module

for

Lagrange Polynomials

 

Background.

    We have seen how to expand a function  [Graphics:Images/LagrangePolyMod_gr_1.gif] in a Maclaurin polynomial about [Graphics:Images/LagrangePolyMod_gr_2.gif] involving the powers [Graphics:Images/LagrangePolyMod_gr_3.gif] and a Taylor polynomial about [Graphics:Images/LagrangePolyMod_gr_4.gif] involving the powers [Graphics:Images/LagrangePolyMod_gr_5.gif].  The Lagrange polynomial of degree [Graphics:Images/LagrangePolyMod_gr_6.gif] passes through the [Graphics:Images/LagrangePolyMod_gr_7.gif] points  [Graphics:Images/LagrangePolyMod_gr_8.gif]  for  [Graphics:Images/LagrangePolyMod_gr_9.gif]  and were investigated by the mathematician Joseph-Louis Lagrange (1736-1813).   

Theorem ( Lagrange Polynomial ).  Assume that  [Graphics:Images/LagrangePolyMod_gr_10.gif] and  [Graphics:Images/LagrangePolyMod_gr_11.gif] for  [Graphics:Images/LagrangePolyMod_gr_12.gif]  are distinct  values.  Then

    [Graphics:Images/LagrangePolyMod_gr_13.gif],
    
where [Graphics:Images/LagrangePolyMod_gr_14.gif] is a polynomial that can be used to approximate  [Graphics:Images/LagrangePolyMod_gr_15.gif],

    [Graphics:Images/LagrangePolyMod_gr_16.gif]  

and we write  

    [Graphics:Images/LagrangePolyMod_gr_17.gif].

The Lagrange polynomial goes through the [Graphics:Images/LagrangePolyMod_gr_18.gif] points  [Graphics:Images/LagrangePolyMod_gr_19.gif],  i.e.

    [Graphics:Images/LagrangePolyMod_gr_20.gif]    for   [Graphics:Images/LagrangePolyMod_gr_21.gif].  

The remainder term  [Graphics:Images/LagrangePolyMod_gr_22.gif] has the form

    [Graphics:Images/LagrangePolyMod_gr_23.gif],

for some value [Graphics:Images/LagrangePolyMod_gr_24.gif] that lies in the interval [Graphics:Images/LagrangePolyMod_gr_25.gif].  

Proof  Lagrange Polynomials  Lagrange Polynomials  

 

    The cubic curve in the figure below illustrates a Lagrange polynomial of degree n = 3, which passes through the four points [Graphics:Images/LagrangePolyMod_gr_26.gif] for  [Graphics:Images/LagrangePolyMod_gr_27.gif].  
    

[Graphics:Images/LagrangePolyMod_gr_28.gif]

[Graphics:Images/LagrangePolyMod_gr_29.gif]

[Graphics:Images/LagrangePolyMod_gr_30.gif]
[Graphics:Images/LagrangePolyMod_gr_31.gif]

Theorem.  (Error Bounds for Lagrange Interpolation, Equally Spaced Nodes)  Assume that  [Graphics:Images/LagrangePolyMod_gr_32.gif]  defined on [Graphics:Images/LagrangePolyMod_gr_33.gif],  which contains the equally spaced nodes  [Graphics:Images/LagrangePolyMod_gr_34.gif].  Additionally, assume that    [Graphics:Images/LagrangePolyMod_gr_35.gif]  and the derivatives of  [Graphics:Images/LagrangePolyMod_gr_36.gif]  up to the order  [Graphics:Images/LagrangePolyMod_gr_37.gif]  are continuous and bounded on the special subintervals  [Graphics:Images/LagrangePolyMod_gr_38.gif], [Graphics:Images/LagrangePolyMod_gr_39.gif], [Graphics:Images/LagrangePolyMod_gr_40.gif], [Graphics:Images/LagrangePolyMod_gr_41.gif], and [Graphics:Images/LagrangePolyMod_gr_42.gif], respectively;  that is,

    [Graphics:Images/LagrangePolyMod_gr_43.gif],  

for  [Graphics:Images/LagrangePolyMod_gr_44.gif].  The error terms corresponding to these three cases have the following useful bounds on their magnitude  

(i).    [Graphics:Images/LagrangePolyMod_gr_45.gif][Graphics:Images/LagrangePolyMod_gr_46.gif]   is valid for  [Graphics:Images/LagrangePolyMod_gr_47.gif],  

(ii).    [Graphics:Images/LagrangePolyMod_gr_48.gif][Graphics:Images/LagrangePolyMod_gr_49.gif]   is valid for  [Graphics:Images/LagrangePolyMod_gr_50.gif],  

(iii).    [Graphics:Images/LagrangePolyMod_gr_51.gif][Graphics:Images/LagrangePolyMod_gr_52.gif]   is valid for  [Graphics:Images/LagrangePolyMod_gr_53.gif],  

(iv).    [Graphics:Images/LagrangePolyMod_gr_54.gif][Graphics:Images/LagrangePolyMod_gr_55.gif]   is valid for  [Graphics:Images/LagrangePolyMod_gr_56.gif],  

(v).    [Graphics:Images/LagrangePolyMod_gr_57.gif][Graphics:Images/LagrangePolyMod_gr_58.gif]   is valid for  [Graphics:Images/LagrangePolyMod_gr_59.gif].  

Proof  Lagrange Polynomials  Lagrange Polynomials  

 

Animations (Lagrange Polynomials  Lagrange Polynomials).  Internet hyperlinks to animations.

 

Algorithm ( Lagrange Polynomial ).  To construct the Lagrange polynomial  

    [Graphics:Images/LagrangePolyMod_gr_60.gif]  
    
of degree [Graphics:Images/LagrangePolyMod_gr_61.gif],  based on the [Graphics:Images/LagrangePolyMod_gr_62.gif] points [Graphics:Images/LagrangePolyMod_gr_63.gif] for  [Graphics:Images/LagrangePolyMod_gr_64.gif].  The Lagrange coefficient polynomials  [Graphics:Images/LagrangePolyMod_gr_65.gif]  for degree [Graphics:Images/LagrangePolyMod_gr_66.gif] are:  

    [Graphics:Images/LagrangePolyMod_gr_67.gif]  for  [Graphics:Images/LagrangePolyMod_gr_68.gif].

 

Computer Programs  Lagrange Polynomials  Lagrange Polynomials  

 

You can use the first Mathematica subroutine that does things in the "traditional way" or you are welcome to use the second subroutine that illustrates  "Object Oriented Programming."  

Mathematica Subroutine (Lagrange Polynomial). Traditional programming.

[Graphics:Images/LagrangePolyMod_gr_69.gif]

The above algorithm is sufficient for understanding and/or constructing the Lagrange polynomial.  

Object Oriented Programming.  Welcome to the brave new world of "Object Oriented Programming."  Use the following Mathematica subroutine which is "programmed" using the "mathematical objects"  [Graphics:Images/LagrangePolyMod_gr_70.gif].  Templates for the objects are located by going to "File" then select "Palettes", then select "BasicInput."  

Mathematica Subroutine (Lagrange Polynomial). Object oriented programming.

[Graphics:Images/LagrangePolyMod_gr_71.gif]

Mathematica Subroutine (Lagrange Polynomial). Compact object oriented programming.

[Graphics:Images/LagrangePolyMod_gr_72.gif]

Getting comfortable with objects.

 

Example 1. Construct three interpolating polynomials of degree  n=1  for the function  [Graphics:Images/LagrangePolyMod_gr_106.gif]  over  [Graphics:Images/LagrangePolyMod_gr_107.gif].  
Use the following sets of interpolation nodes.
1 (a).  Use the nodes  [Graphics:Images/LagrangePolyMod_gr_108.gif].  
1 (b).  Use the nodes  [Graphics:Images/LagrangePolyMod_gr_109.gif].  
1 (c).  Use the nodes  [Graphics:Images/LagrangePolyMod_gr_110.gif].
Solution 1.

 

Example 2.   Form several Lagrange polynomials of degree  n = 2, 3, 4, and 5  for the function  [Graphics:Images/LagrangePolyMod_gr_163.gif]  over the interval  [Graphics:Images/LagrangePolyMod_gr_164.gif]  using  n+1 equally spaced nodes.  Then compare the four Lagrange polynomials.
Solution 2 (a).
Solution 2 (b).
Solution 2 (c).
Solution 2 (d).
Solution 2 (e).

 

Example 3.  Error Analysis.  Investigate the error for the Lagrange polynomial approximations of degree  n = 2, 3, 4, and 5 in Example 2.
Solution 3 (a).
Solution 3 (b).
Solution 3 (c).
Solution 3 (d).

 

Example 4.  Summary of the maximum error and the error bounds over the interval  [0, 1] that were found in Example 3.
4 (a).  Find  [Graphics:Images/LagrangePolyMod_gr_321.gif].  
4 (b).  Find  [Graphics:Images/LagrangePolyMod_gr_322.gif].  
4 (c).  Find  [Graphics:Images/LagrangePolyMod_gr_323.gif].  
4 (d).  Find  [Graphics:Images/LagrangePolyMod_gr_324.gif].  
Solution 4.

 

Various Scenarios and Animations for Lagrange Polynomials.

Example 5.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_346.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_347.gif], [Graphics:Images/LagrangePolyMod_gr_348.gif], and [Graphics:Images/LagrangePolyMod_gr_349.gif].  
Solution 5 (a).
Solution 5 (b).
Solution 5 (c).

 

Example 6.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_377.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_378.gif].  
Solution 6.

 

Example 7.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_388.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_389.gif].  
Solution 7.

 

Example 8.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_399.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_400.gif], and [Graphics:Images/LagrangePolyMod_gr_401.gif].  
Solution 8 (a).
Solution 8 (b).

 

Example 9.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_420.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_421.gif].  
Solution 9.

 

Example 10.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_431.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_432.gif].  
Solution 10.

 

Example 11.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_442.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_443.gif].  
Solution 11.

 

Example 12.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_453.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_454.gif].  
Solution 12.

 

Example 13.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_464.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_465.gif].  
Solution 13.

 

Example 14.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_475.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_476.gif].  
Solution 14.

 

Example 15.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_486.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_487.gif].  
Solution 15.

 

Example 16.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_497.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_498.gif].  
Solution 16.

 

Example 17.  Find the Lagrange polynomial approximation for  [Graphics:Images/LagrangePolyMod_gr_508.gif], on the interval [Graphics:Images/LagrangePolyMod_gr_509.gif].  
Solution 17.

 

Animations (Lagrange Polynomial Approximation  Lagrange Polynomial Approximation).  Internet hyperlinks to animations.

 

Old Lab Project (Lagrange Polynomial Approximation  Lagrange Polynomial Approximation).  Internet hyperlinks to an old lab project.  

 

Research Experience for Undergraduates

Lagrange Polynomials  Lagrange Polynomials  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook Lagrange Polynomials

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004