DIRECT METHOD    

INTERACTIVE E-BOOK

INTERPOLATION

MAJOR

GENERAL

On non Internet Explorer browsers, the equations may not show up.

As an alternative or if you prefer,

you can see the pdf version of the ebook instead

Title

An interactive e-book for illustrating the Direct Method for interpolation.

Creator

Autar K Kaw

Subject and Keywords

Direct Method, Interpolation, Mathcad, Maple, Mathematica, Matlab, Simulations.

Description

An interactive E-book for illustrating Direct Method for interpolation.  It includes links to simulations in Mathcad, Maple, Mathematica and Matlab for the algorithm, multiple choice quizzes, problem set, and a PowerPoint presentation.

Publisher

Holistic Numerical Methods Institute,

College of Engineering,

University of South Florida, Tampa, FL 33620-5350.

Contributors

Autar Kaw, Peter Warr, Michael Keteltas

Format

Text/HTML

Last Revised

June 14, 2004

Identifier

 

Language

English

Rights

http://numericalmethods.eng.usf.edu/rights.htm

 

Table of Contents

Background

        What is Interpolation

Direct Method of Interpolation

         PowerPoint presentation

Examples

          Example 1: First order polynomial

          Example 2: Second order polynomial

          Example 3: Third order polynomial

          Simulation ([MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB])

Problem Sets

         Multiple choice question examination

        A set of homework assignment problems

 

Background

This is an example of how an instructor of a Numerical Methods course can develop an E-book on a single topic by using resources that are only available at the Holistic Numerical Methods Institute (HNMI) Website.

Although one of the primary advantages of a web-based resource is that one can use documents outside of its own domain, we are particularly using this example as a way to illustrate the holistic nature of the resources available at HNMI.   You are welcome to modify and edit this e-book to suit your purpose.

Using the textbook document written in MS Word 2000 as a foundation, it was made interactive within MS Word 2000 by putting bookmarks and hyperlinks to background information, PowerPoint presentations, Mathcad simulations, historical anecdotes, multiple choice tests, problem sets, etc.  Then the MS Word 2000 file was saved as a webpage and that is what you are about to read here.

Back to TOC

What is interpolation?

Many a times, a function  is given only at discrete points such as .  How does one find the value of ‘y’ at any other value of ‘x’?  Well, a continuous function may be used to represent the ‘n+1’ data values with  passing through the ‘n+1’ points.  Then one can find the value of y at any other value of x.   This is called interpolation.  Of course, if 'x' falls outside the range of 'x' for which the data is given, it is no longer interpolation but instead is called extrapolation. 

 

So what kind of function  should one choose?  A polynomial is a common choice for an interpolating function because polynomials are easy to

(A)   Evaluate

(B)   differentiate, and

(C)   integrate

as opposed to other choices such as a sine or exponential series.

            Polynomial interpolation involves finding a polynomial of order ‘n’ that passes through the ‘n+1’ points.  One of the methods is called the direct method of interpolation.  Other methods include Newton’s divided difference polynomial method and Lagrangian interpolation method.  We discuss the direct method in this section.


Figure 1: Interpolation of discrete data

 

Back to TOC

DIRECT METHOD

The direct method of interpolation is based on the following premise.  Given 'n+1' data points, fit a polynomial of order 'n' as given below

                                                                             (1)

through the data, where a0, a1, . . ., an are n+1 real constants.    Since n+1 values of y are given at n+1 values of x, one can write n+1 equations.  Then the 'n+1' constants, a0, a1, . . ., an, can be found by solving the n+1 simultaneous linear equations.  To find the value of y at a given value of x, simply substitute the value of x in equation (1).

But, it is not necessary to use all the data points.  How does one then choose the order of the polynomial and what data points to use?  This concept and the direct method of interpolation are best illustrated using examples.

Back to TOC

 

 

Simulation ([MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB])

 

Example 1

The upward velocity of a rocket is given as a function of time in Table 1.


Table 1:  Velocity as a function of time

 

t

v(t)

s

m/s

0

0

10

227.04

15

362.78

20

517.35

22.5

602.97

30

901.67

 

Determine the value of the velocity at t=16 seconds using the direct method and a first order polynomial.

Figure 2: Velocity vs. time data for the rocket example

 

 

Solution

For the first order polynomial (also called linear interpolation), we choose the velocity given by

     

Figure 3: Linear interpolation

Since we want to find the velocity at t=16, we choose two data points that are closest to t=16 and that also bracket t=16.  Those two points are to=15 and t1=20.  Then

gives

           

           

Writing the equations in matrix form

           

and solving the above two equations gives,

           

           

Hence

           

           

         

                 

Back to TOC

Example 2

The upward velocity of a rocket is given as a function of time in Table 2.

 

Table 2:  Velocity as a function of time

t

v(t)

s

m/s

0

0

10

227.04

15

362.78

20

517.35

22.5

602.97

30

901.67

Determine the velocity at t = 16 seconds using direct method and a second order polynomial.

Solution:

For second order polynomial interpolation (also called quadratic interpolation), we choose the velocity given by

           

 

 

 


                                             Figure 4: Quadratic interpolation

Since we want to find the velocity at t=16, we need to choose data points that are closest to t=16 and that also bracket t=16.  These three points are t0=10, t1=15, t2=20.

           

           

gives

Writing the three equations in matrix form

           

and the solution of the above three equations gives

           

           

           

Hence

           

At t = 16,

           

                   

 

The absolute relative approximate error obtained between the results from the first and second order polynomial is

                 

Back to TOC

Example 3

The upward velocity of a rocket is given as a function of time in Table 3.

Table 3:  Velocity as a function of time

t

v(t)

s

m/s

0

0

10

227.04

15

362.78

20

517.35

22.5

602.97

30

901.67

a)      Determine the value of the velocity at t=16 seconds using direct method and a third order polynomial interpolation using direct method. Find the absolute relative approximate error for the third order polynomial approximation.

b)      Using the third order polynomial interpolant for velocity from part (a), find the distance covered by the rocket from t=11s to t=16s.

c)      Using the third order polynomial interpolant for velocity from part (a), find the acceleration of the rocket at t=16s.

Solution

a)   For the third order polynomial (also called cubic interpolation), we choose the velocity given by

           

Since we want to find the velocity at t=16, and we are using a third order polynomial, we need to choose the four points closest to  and that also bracket  to evaluate it.

The four points are t0=10, t1=15, t2=20 and t3=22.5.

           

           

           

such that

           

Writing the four equations in matrix form, we have

           

Solving the above four equations gives

           

           

           

Hence

   

The absolute percentage relative approximate error,  for the value obtained for v(16) between second and third order polynomial is

                 

b)      The distance covered by the rocket between t=11s and t=16s can be calculated from the interpolating polynomial

           

Note that the polynomial is valid between t=10 and t=20 and hence includes the limits of integration of t=11 and t=16.

So

 

                                   

                                    =     

                                   

c)      The acceleration at t=16 is given by

           

Given that ,

                    

Back to TOC

 

Problem Set

 

1. You are given data for the upward velocity of a rocket as a function of time in the table below.

t

v(t)

[s]