Date post: | 01-Dec-2014 |
Category: |
Documents |
Upload: | winnie-mutuku |
View: | 201 times |
Download: | 12 times |
THE KENYA METHODIST UNIVERSITY
P.O. Box 267MERU
MATHS 320: NUMERICAL ANALYSIS 1
Course Instructor: Winifred MutukuDepartment of Pure and Applied Sciences.
MATHS 320: NUMERICAL ANALYSIS 1
INTRODUCTION
This course will introduce the students to the general concepts and skills of mathematics
essential for application in problem solving and computational disciplines.
COURSE OBJECTIVES
During the course, the undergraduate student will be able to:
- Understand the algebra of the number systems, introduction to errors, sources of
errors and propagation of errors.
- Use Taylor’s series and Lagrange’s Interpolation to reconstruct the function f(x)
and determine the root of a function f(x) = 0 by bisection method, Secant,
Newton-Raphson and False-position methods.
- Interpolation based on finite difference operators; forward, backward and central
and form their respective difference tables.
- Understand the concept of Lagrange and Newton interpolation, find an
approximate value by Lagrange Interpolation; find unique polynomial by
Lagrange interpolation and Newton divided difference.
- State and use the least squares and Chebychev’s approximations
- Know the various numerical methods used to find derivative of a function f(x)
like methods based in interpolation, finite differences and undetermined
coefficient. Extrapolation to the limit.
1
COURSE CONTENT
- Number System.
- Introduction to errors
- Lagrange interpolation
- Finite difference
- Interpolation based on finite differences.
- Least square approximations
- Chebychev’s approximations
- Numerical differentiation.
- Extrapolation to the limit.
2
TEACHING AND LEARNING METHOD’S
Lecture method consisting of stating, illustrating, proving various numerical
methods. Application of these methods are given by use of examples.
Questions and answer method.
Tutorials in which problem solving techniques and general discussion are
conducted regularly.
Tests and assignments are continuously given to test students progress and
understanding and discussed together after grading.
STUDENTS ASSESSMENT
Assignment
Course Examination
Individual student’s marks of these assignments will contribute to the final examination
mark and grade for the course.
3
COURSE OUTLINE FOR THE TRIMESTER
WEEK 1 and 2
Number Systems
WEEK 3
Approximations and errors
WEEK 4
Lagrange interpolation
WEEK 5 and 6
Finite difference
Interpolation based on finite differences.
WEEK 7
Least square approximations
WEEK 8
Chebychev’s approximations
WEEK 9 and 10
Numerical differentiation.
WEEK 11 and 12
4
Extrapolation to the limit.
WEEK 13 and 14
Assignments
Course Examinations
LEARNING RESOURCES
Hilderbrand, F.B: Introduction to Numerical Analysis; 2nd Edition, McGraw-Hill, Inc., 1991.
Hultquist, P.F.: Numerical Methods for Engineers and Scientists; Benjamin/Cummings Publishing Company, Inc., 1988
Germund, D.; Numerical Methods; Prentice-Hall, Inc., 1974
5
Students Learning Objectives
WEEK 1 and 2
1) State the various number systems
2) Perform the basic operation of the different number systems
3) Convert between different number system
4) Represent data using floating point and fixed point methods.
5) Evaluate the complement of denary and binary number systems and use them to
perform subtraction of numbers.
Introduction
Numerical analysis or computing is an approach for solving complex mathematical
problems using only simple arithmetic operations. It involves formulation of
mathematical models of physical situations that can be solved with arithmetic operations.
It can be used in the following areas.
i. Finding roots of equations
ii. Solving systems of linear algebraic equations.
iii. Interpolation and regression analysis.
iv. Numerical integration.
v. Numerical differentiation.
vi. Solution of differential equations
vii. Boundary value problems
viii. Solution of matrix problems.
6
NUMBER SYSTEMS
There are different number systems depending on the base/radix. The number systems are
1. Decimal Number System
2. Binary Number System
3. Octal Number System
4. Hexadecimal Number System
5. Duodecimal Number System
Decimal Number System
This is also known as denary number system. It has 10 digits/symbols; 0, 1, 2, ……., 9.
The digits are 10, hence its base is 10. Every number in the system is interpreted as a sum
of multiples of integer powers of 10.
For example,
1. = 4 x 103 + 9 x 102 + 8 x 101+ 7 x 101
2.
The expanded notation for the integer part of a decimal number is
Where is the decimal digits 0, 1, 2, ……, 9 and m is the number of digits.
The fractional part of a decimal number is represented as
, where n is the number of digits in the fractional part.
7
BINARY NUMBER SYSTEM
The binary number system has a base of 2 with digits 0 and 1. These digits/symbols are
known as bits. It is represented as a sum of multiples of integer powers of 2.
For example,
i.
In general, the integer part of a binary number can be written as
, where
are the binary symbols/digits 0 and 1.
This can be generalized to any base b as;
, where b is an integer greater than 1 and digits are between 0
and b-1.
Note: the base is also called radix and the fractional point is called the radix point.
Exercise
Convert to denary number system.
HEXADECIMAL NUMBER SYSTEM
The base to the hexadecimal number system is 16 and the digits/symbols used are 0, 1, 2,
……..9 and A, B, C, ….., F. The letters A to F represent the digits 10, 11,…. To 15
respectively. The hexadecimal number system is a sum of multiples of integer powers of
16.
For example,
8
Exercise
1. Convert the following hexadecimal numbers to Denary number system
a.
b.
Converting Binary Number to Hexadecimal
i. Group the binary digits in sets of four
ii. Convert each group to its equivalent.
Example
Convert to hexadecimal number system
Solution
0111 1010 0001 0010 0001
0111 =
Similarly,
1010 = 10 = A
0001 = 1
0010 = 2
0001 = 1
Thus
9
OCTAL NUMBER SYSTEM
The octal number system has 8 digits and hence is of base 8. The digits /symbols are 0, 1,
2, ……, 7. Any number is a sum of multiples of integer powers of 8.
Example
Question
Convert the following Octal numbers into their denary equivalent
a)
b)
Converting Binary Number to Octal
a) Group the binary digits into sets of 3
b) Convert each set to its denary equivalent.
Example
Convert to octal number system
Solution
001 011 010
001 =
Similarly,
011 = 3
010 = 2
Thus
10
DUODECIMAL NUMBER SYSTEM
The duodecimal number system has 12 symbols/digits.The digits are 0, 1, 2,….., 9 and X
and . The last 2 symbols represent 10 and 11 respectively. The duodecimal number
system is a sum of multiples of integer powers of 12.
Example
Question
Convert to its denary equivalent.
Exercise
Express the following numbers in denary number system.
a)
b)
c)
d)
CONVERSION OF NUMBERS
Non-Decimal System to Decimal Systems
The following algorithm is used to convert numbers in base2, base8, base 12 and base16
to a decimal number.
Integer Part
11
1. Multiply the left most digit by the base b.
2. Add the next digit to the right to the product.
3. Multiply the sum by the base and add the next digit.
4. Continue the process until the last (right most) digit is added.
The sum is the decimal equivalent of the given integer number.
Fractional Part.
1. Multiply the right most digit by b-1.
2. Add the next digit to the left to the product.
3. Multiply the sum by b-1 and add the next digit.
4. Continue the process until the last (left most) digit in the fractional part is added.
The product is the decimal equivalent of the given fractional number.
Example.
1. Convert to its decimal equivalent.
Solution
Integer Part
1 1 0 1
1x2=2
2+1=3x2
6+0= 6x2
12+1 = 13
Decimal part
1 1 0 1
12
1x2-1=05
0.5+0 = 0.5x2-1=0.25
0.25+1=1.25x2-1=0.625
0.625+1=1.625x2-1=0.8125
Thus
2. Convert to its denary equivalent.
Solution
1 2 A F
1 x 16 = 16
16 + 2 = 18 x 16 = 288
288 + 10 = 298 x 16 = 4768
4768 + 15 = 4783
Thus
Exercise
1. Convert the following numbers to denary number system.
a.
b.
c.
d.
13
Denary System to Non-Denary Systems.
The following algorithm is used to convert numbers in denary number system to base2,
base8, base 12 and base16.
Integer Part
1. Divide the integer part by the base b of the new system. The remainder will
constitute the right digit of the integer part of the new number.
2. Divide the quotient again by the base b. the remainder is the 2nd digit from the
right.
3. Continue the process until zero quotients is obtained. The last remainder is the left
most digit of the new number.
Example 1
Change to binary.
Thus
Solution
2 2452 12212 6102 30 12 1502 712 312 112 01
14
Example 2
Convert to octal.
Solution
8 524
8 65 4
8 81
8 10
8 01
Thus
Question
Convert to duodecimal.
Fractional part
1. Multiply the fractional part of the decimal number by the base b of the new
system. The integral part of the product constitutes the left most digit of the
fractional part of the new number.
2. Multiply the fractional part of the product by the base. The integral part of the
resultant product is the 2nd digit from the left.
3. Continue the process until a zero fractional part occurs. The integer part of the last
product will be the right most digit of the fractional part of the new number.
15
Example
1) Change octal.
Solution
0.526 x 8 = 4.208
0.208 x 8 = 1.664
0.664 x 8 = 5.312
0.312 x 8 = 2.496 and so on.
Thus the number
Change to binary.
Solution
Integer part
2 43
2 21 →1
2 10 →1
2 5 → 0
2 2 → 1
2 1 → 0
2 0 → 1
Decimal Part
0.375 x 2 = 0.75
0.75 x 2 = 1.50
16
0.50 x 2 = 1.00
Thus
Questions
1) Convert the following numbers to the stated number system.
a) to duodecimal
b) to octal
c) to hexadecimal
d) to binary
Octal and Hexadecimal Conversions
Using the binary system as an intermediate stage, we can convert octal numbers to
hexadecimal numbers and vice versa.
Octal to Hexadecimal
1) Evaluate the binary equivalent of each octal number.
2) Regroup them into quadruplets and convert each group to its hexadecimal equivalent.
Hexadecimal to Octal
1) Evaluate the binary equivalent of each hexadecimal number.
2) Regroup them into triplets and convert to its octal equivalent.
Example
1) Convert to hexadecimal
Solution
2 2
17
2 1→ 0
2 0 → 1
2 0 → 0
2 4
2 2 →0
2 1 →0
2 0 → 1
2 3
2 1 → 1
2 0 → 1
2 0 → 0
Thus
Regrouping into 4’s we have 0000 1010 0011
2) Convert to Octal
Solution
Converting each digit into binary gives
18
Regrouping into 3’s
00 111 001.101 110 00
Questions
1. Convert
a.
b.
c. to its octal, binary and hexadecimal forms
2. Express
a.
b. to its binary, octal and denary forms.
REPRESENTING NUMBERS
19
Computers use binary digits to represent numbers and other information. The memory is
organized into strings of bits called words. Each string has the same length in a particular
computer, although different computers may use different word lengths. The largest
number a computer can store depends on its word length. For example the largest binary
number a 16bit word can hold is 16bits of 1. This binary number is equivalent to a
decimal value of 65535.
The largest decimal number that can be stored in a computer is given by the relation
, where n is the word length in bits. Decimal numbers are first
converted into the binary equivalent and then represented in either fixed point form or
floating point form.
Fixed Point Form
For integers, the decimal or binary point is always fixed to the right of the least
significant digits, hence fractions are not included. Negative numbers are stored using the
2’s complement.
Example.
Represent -13 in binary form
Solution
, the extra zero to the left of the binary number is to indicate that
the number is negative.
Note: If the left most digit is 1, the number is positive.
Converting the number into 1’s complement.
Inverting each digit and adding 1 to the last bit we have
20
10010
+ 1
_____________
10011
The left most bit of a binary number which is used to indicate the sign is called the sign
bit. Thus we have n – 0 bits to represent the number. Thus a 16 bit word can contain
numbers -215 to 215 -1 (-32768 to 32767).
Floating Point Representation
Large numbers and fractional numbers are stored and processed in exponential form.
These numbers have an embedded decimal point and are called floating point numbers or
real numbers. A floating point number is characterized by 4 parameters, the base, the
number of digits t and the exponent range (m, M).
Definition1
A floating point number is a number represented in the form
………………………………………….(1)
Where are integers and satisfy .
The exponent e is such that . The fractional part is called the
Mantissa and it lies between +1 and -1.
The following numbers have been expressed in floating point form
1) 0 =
21
2)
3)
For floating point numbers the memory location is divided into 3 fields(part) as shown
below.
Typically, floating numbers use a field width of 32bits where 24 bits are used for the
mantissa, 7bits for the exponent.
Exercise
1) Convert the following numbers to floating numbers
a) 0.00596
b) 65.7451
c) -486.8
Normalization
The shifting of the decimal point to the left of the most significant digit is called
Normalization and the numbers represented in normalized form are called Normalized
Floating Point numbers.
S
I G
N
E X P O N E N T
MA
NT
ISS
A
22
Example: Given 0.00011101 x 107, shifting the fractional part 3 places to the left results
in the number 0.11101 x 104 which is the normalized floating point number.
Floating Point Arithmetic
Addition
If x + y = z, let the fractional parts and the exponents be fx, fy & fz and Ex, Ey and Ez,
then the addition algorithm is
i. Set Ez = the largest of Ex and Ey. Suppose Ex Ey, then Ez = Ex.
ii. Shift Fy to the right by Ex – Ey places to make the exponent of Fx and Fy the
same.
iii. Set Fz = Fx + Fy.
iv. Normalize the sum and express as .
Example
Add 0964572E2 and 0.586351E5.
Solution
Question
Add 0.735816E4 and 0.635742E4
23
Subtraction
Subtract 0.994576E-3 from 0.999658E-3
Solution
Multiplication
Algorithm
i. Multiply the fractional part:
ii. Add the exponents:
iii. Normalize if necessary.
Example
Multiply out 0.200000E4 and 0.400000E-2
Solution
Division
Algorithm
iv. Divide the fractional part:
v. Subtract the exponents:
24
vi. Normalize if necessary.
Example
Divide 0.876543E-5 by 0.200000E-3
Solution
Exercise
1. Add 0.500000E1 and 0.100000E-7
2. Multiply 0.350000E40 by 0.500000E70
3. Divide 0.875000E-18 by 0.200000E95
4. Subtract 0.499998 from 0.500000
5. let , show that
a. (x + y) + z = x + (y + z)
b.
c.
Definition2
A non-zero floating point number (1) is in normal form if the value of the mantissa lies in
the interval or in the interval .
25
Definition3
A non-zero floating point number (1) is in t-digit mantissa standard from if it is
normalized and its mantissa consists of exactly t digits.
Is a number x has the representation in the form
………………….(2)
Then the floating point number f(x) in t-digit mantissa standard form can be obtained in
the following ways.
1. Chopping
Here we neglect in (2) and obtain
……………………………
(3)
2. Rounding
Here the fractional part in (2) is written as
if and the first digits
are taken to write the floating point number.
Example
Find the sum of 0.123x103 and 0.456x102 and write the results in 3digit mantissa.
Solution
26
= 0.168 x 103 for Chopping
= 0.169 x 103for rounding.
Week 3
APPROXIMATION AND ERRORS.
A computer has a finite word length and so only a fixed number of digits are stored and
used during computation. This means during storing exact decimal numbers in its
converted form in the computer memory, an error is introduced. This error is machine
dependent and is called machine epsilon. After the computation is over, the result in the
machine form (with base ) is again converted to decimal form understandable to the
users and some more error may be introduced at this stage.
The error = True value – Approximate value
The relative error = …………………………………(5)
Absolute error = …………………………(6)
27
Types of Errors
1) Inherent Error
these are errors present in the data supplied to the computer. They are present in the
statement of the problem before solution. They are of two types.
a) Data Errors
These arise when data is obtained by some experimental means and are therefore
of limited accuracy and precision.
b) Conversion Errors
These arise due to the limitation of the computer to store the data exactly after
converting from one number system to another.
2) Numerical Errors
They are introduced during the process of implementation of a numerical method.
They are of two forms;
a) Round-off Errors
They occur when a fixed number of digits are used to represent exact numbers.
The round off error is the quantity e which must be added to the finite
representation of a computed number in order to make it the true representation of
that digit. Thus, if x is the computed number given by
, then
thye relative error (5) for t-digit mantissa standard form representation of x
becomes
28
Thus the bound on the relative error of a floating point number is reduced by half
when rounding is used than chopping.
b) Chopping Errors
The extra digits are dropped. For instance if we use a computer with a fixed word
length of 4 digits, then the number 42.79893 can be expressed as follows
This can be expressed in the general form as
True x =
Where fx - Mantissa, d - length of the mantissa, E – exponent.
SOLUTION OF NON-LINEAR EQUATIONS
Consider equations of the form
………………………………………………….. 2.1
Where is a polynomial of degree in
x.
Definition
29
A number is a solution of f(x) = 0, if f() . Such a solution is called a root or zero of
f(x) = 0.
Geometrically, a root of the equation 2.1 is the value of x at which the graph of y = f(x)
intersects the x – axis. Equation 2.1 can be solved using the following two methods.
i. Direct Methods
These methods give the exact value of the roots in a finite number of steps.
ii. Iterative methods
These methods are based on the idea of successive approximation, that is starting
with one or more initial approximations to the root, we obtain a sequence of
approximations or iterates (xk) which in the limit converges to the root.
Definition
A sequence of iterates (xk) is said to converge to the root if
If xk, xk-1…., xk-m+1 are m approximations to the root then a multipoint iteration method is
defined as
.
The function is called the multipoint iteration function. To get an appropriate initial
approximation it might be necessary to sketch the curve so that any value in the
neighbourhood of the point the curve crosses the x axis may be taken as an initial
approximation.
Alternatively, we can use the Intermediate Value theorem stated below.
Theorem
30
If f(x) is a continuous function on some initial interval and f(a)f(b) < 0 then the
equation f(x) = 0 has atleast one real root or an odd number of roots in the interval (a,b).
Example
Obtain an initial approximation to a root of the equation f(x) = cosx – xex = 0
Solution
We prepare a table of the values of the function f(x) for various values of x.
x 1 0.5 1 1.5 2
f(x) 1 0.0532 -2.1780 -6.6518 -15.1942
From the table f(x) = 0, has at least one root in the interval (0.5, 1).
The exact root correct to 10d.p is 0.5177573637.
Bisection Method
This method is based on the repeated application of the intermediate value theorem.
Suppose the root f(x) = 0 lies in the interval I0 = (a0, b0), then we determine
and denote by I1, the new subinterval which satisfies the IVT.
We then bisect I1 and get a subinterval I2 which satisfies the IVT. Continuing this way we
obtain a sequence of nested sets of such intervals such that each
subinterval contains the root.
Suppose we repeat the bisection q times, then we obtain either the root or the subinterval
Iq of length which contains the root.
31
We take the midpoint of the last subinterval as the desired approximation to the root. If
the permissible error is , then the approximate number of iterations required is obtained
from the relation
Example
Perform five iterations of the bisection method to obtain the smallest positive root of the
equation f(x) = x3 – 5x + 1 = 0
Solution
Since f(0) = 1 > 0 and f(1) = -3 < 0, then the smallest root lies in the interval (0, 1).
Taking a0 = 0 and b0 = 1 we get,
F(m1) = -1.375 and f(a0)f(m1)<0.
Thus the root lies in the interval (0, 0.5). The sequence of interval are given in the table
below.
k ak-1 bk-1 mk f(mk)
1 0 1 0.5 < 0
2 0 0.5 0.25 < 0
3 0 0.25 0.125 < 0
4 0.125 0.25 0.1875 < 0
5 0.1875 0.25 0.21875 < 0
Hence the root lies in (0.1875, 0.21875)
x = 0.203125
32
ITERATIVE METHODS BASED ON 1ST DEGREE EQUATIONS
Suppose f(x) = a0x + a1 = 0 …………………………………………………….2.1,
is a 1st degree approximation of f(x) then the solution of 2.1 is given by
…………………………………………………………3.1
Where a0 = 0 and a1 are arbitrary parameters.
SECANT METHOD
If xk-1 and xk are two approximations to the root, then to get a0 and a1 we use the
conditions
, where
, where
………………………………………………………..4.1
Which implies ……………………………………..5.1
This is called the Secant or the Chord Method.
33
THE REGULA – FALSI METHOD
If the approximations in the secant method are such that f(x) f(xk-1) < 0, then the method
is known as the Regula-Falsi method.
Example
Use the Secant and Regula-Falsi methods to determine the root of the equation
Cos x – xex = 0
Solution
Taking the initial approximations as x0 = 0, x1 = 1, we have for the secant method
F(0) = 1
F(1) = cos 1 – e = -2.17797523
F(x2) = f(0.3146653378) = 0.519871175
The computed results are as follows.
k xk+1 f(xk+1)
2 0.44678144 0.519871
3 0.5317058606 -0.429311 x 10-1
4 0.5169044676 0.259276 x 10-2
5 0.5977477653 0.301119 x 10-4
6 0.5177573708 -0.215132 x 10-7
7 0.5177573637 0.178663 x 10-12
34
8 0.517757367 0.222045 x 10-15
Hence the root is 0.5178 (4d.p)
The table for Regula- Falsi method is
k xk+1 f(xk+1)
1 0.3146653378 0.519871
2 0.4467281446 0.203545
3 0.4940153366 0.708023 x 10-1
4 0.5099461404 0.236077 x 10-1
.
.
.
.
10 0.5177478783 0.288554 x 10-4
.
.
20 0.5177573636 0.396288 x 10-9
x = 0.5178 (4d.p)
Note: The Secant methods converges faster than the Regula-Falsi method.
THE NEWTON-RAPHSON METHOD
Suppose f(xk) = a0xk + a1, then f`(xk) = a0 …………………………….6.1
a1 = - xk f`(xk) - f(xk)
From 3.1, we have
35
which is the Newton-Raphson Method.
Example
Apply Newton-Raphson Method to determine a root of the equation
f(x) = Cos x – xex = 0 such that f(x*) < 10-8 where x* is the approximation to the root.
Solution
f(x) = Cos x – xex = 0
Since the roots lie in we set xo = 1 and obtain the table below.
k xk f(xk)
0 1
1 0.653079406 -4.606 x 10-1
2 0.531343367 -4.180 x 10-2
3 0.517909913 -4.641 x 10-4
4 0.51775738 -5.926 x 10-7
5 0.517757363 -2.910 x 10-10
X 0.5178
36
POLYNOMIAL INTERPOLATION
Suppose that we have a table of numerical values of a function
x x0 x1 ……… xn
y y0 y1 ……… yn
Table 1.1
We are faced with three problems
i. To find a simple and convenient formulas that reproduces the given points
exactly.
ii. We assume, given the table of numerical values it is contaminated by errors. We
therefore seek a formula that represents the data(approximately) and if possible
filter out the errors.
iii. We need to find a function f that is simple to evaluate and produce a reasonable
approximation to g(which might be given) with full machine precision.
In all these problems, a simple function p can be obtained that represents or approximates
the given table / function f. the representation p can always be taken to be a polynomial.
Uses of Polynomials
i. Reconstruct the function f(x) when it is not given explicitly and only the values of
f(x) and / or its certain order derivatives at a set of points called nodes, tabular
points or arguments are known.
ii. To represent the function f(x) by the interpolating polynomial p(x) so that
common operations such as determination of roots, differentiations and
integrations may be performed using p(x).
37
Definition
A polynomial p(x) is called interpolating polynomial if the values of p(x) and / or its
certain order derivatives coincide with those of f(x) and /or its same order derivatives at
one or more tabular points. Its represented as
,
where n is a non negative integer and a0, a1,….. an are constants.
TAYLOR’S INTERPOLATION
If the polynomial p(x) is written as the Taylor’s expansion for the function f(x) at a point
in the form
………4.1
Then p(x) may be regarded as an interpolating polynomial of degree n, satisfying the
condition.
, k = 0, 1,…….., n. ………………………………………4.2
The term
, x0 < < x……………………………4.3
Which has been neglected in 4.1 is called the remainder or the truncation error.
The number of terms to be included in 4.1 may be determined by the acceptable error. If
this error > 0 and the series in truncated at the term f(n)(x0), then
…………………………………………4.4
38
Where
Example1
Obtain a polynomial approximation p(x) to f(x) = e-x using the Taylor’s expansion about
x0 = 0 and determine
i. X when the error in p(x) obtained from the 1st four terms only is to be less than 10-
6 after rounding.
ii. They number of terms in the approximation to find results correct to 10-10 for
.
Solution
i. From f(x) = e-x, we have
from 4.1,
and from 4.4,
where
x = 120 x 10-7
< 0.058856619
x < 0.06
39
ii. From 4.1 we obtain
, x = 1, M4 = 1
n ≥ 14
LINEAR INTERPOLATION
From Table 1.1, we assume that the xi’s form a set of n +1 distinct points. The table
represents n+1 points in the Cartesian plane and we want to find a polynomial curve that
passes through all the points. Thus we seek to determine a polynomial that is defined for
all x and takes on the corresponding values of yi for each of the n+1 distinct xi’s in this
table. A polynomial p for which p(xi) = yi when is said to interpolate the table.
The points xi are called nodes.
Consider the 1st and simple case, n = 0. Here a constant function solves the problem i.e
the polynomial p of degree 0 defined by p(x) = y0 reproduces the one none table.
For n = 1, since a straight line can be passes through two pints, a linear function is
capable of solving the problem. Explicitly, the polynomial is defined by
…………………………………………..4.5
is of 1st degree and reproduces the table. In this case p(x0) = y0 and p(x1) = y1.
This p is used for linear interpolation.
40
Example 1
Find the polynomial of least degree that interpolates the table below.
x 1.4 1.25
y 3.7 3.9
Solution
By definition
Example 2
Find a polynomial of degree 2 or less to approximate f(x) = sin x near x0 = 0 and use this
polynomial to approximate sin(0.1).
Solution
The equation of this approximating polynomial is
To determine the constants, we let
x0 = 0
P(0) = ao, f(0) = sin 0 = 0 ao = 0
41
and a1 = 1
and a2 = 0
and
The approximating polynomial of degree 3 is given by
0.099833
42
LAGRANGE’S INTERPOLATION
Suppose we wish to interpolate arbitrary functions at a set of nodes x0, x1, ………xn. We
first define a system of n+1 special polynomial of degree n known as cardinal
polynomials. These are denoted by lo, l1,……ln
and
at x = x0, L0(x0) = 1, L1(x0) = 0
x = x1, L0(x1) = 0, L1(x1) = 1
Once these are available, we can interpolate any function f by the Lagrange form of the
interpolating polynomial
where
The formula indicates that li(x) is the product of n linear factors
Example
Determine the 2nd degree interpolating polynomial for using the nodes x0=2,
x1=2.5, and x2=4.0.
Solution
43
……………………………(1)
, ,
and the coefficients are given by
Substituting in the polynomial (1), we have
= 0.05003x2 – 0.425185x + 1.15025
P2(x) 0.05x2 – 0.425x + 1.15
44
Example 2
Find the Lagrange’s interpolating polynomial to interpolate the table below.
x 1
f(x) 2 -1 7
Solution
45
NEWTON’S DIVIDED DIFFERENCE INTERPOLATION
This is in the form
……….4.6
Where and is called the 1st divided difference of f(x)
relative to x0 and x1.
Equation 4.6 may be written as
…………………………………………………….4.7
Equation 4.6 and 4.7 are the linear Newtonian interpolating polynomial with divided
differences.
TRUNCATED ERROR BOUNDS
The polynomial p(x) coincides with the function f(x) at x0 and x1 and it deviates at all
other points in the interval (x0, x1) as shown below.
46
This deviation is called the truncation error and may be written as
E(f,x) = f(x) – p(x).
Rolle’s Theorem
If g(x) is continuous on the interval [a,b] and if g(a) = 0, g(b) = 0, then there is at least
one point inside (a,b) for which g`() = 0.
If , , x1 is fixed, then for this x we define a function g(t) as
…………………………..4.8
g(t) = 0 for t = x0, x1 and x.
Differentiating 4.8 twice with respect to x we get
47
, since P’’(t) = 0 by Rolle’s Theorem. …..4.9
Solving 4.9 we have
……………………………………4.10
Where min(x0, x1, x) < < max (x0, x1, x)
the truncation error in linear interpolation is given by
………………………………………4.11
The bound for f’’(x) in [x0,x1] i.e , then
…………………………..4.12
The max value of occurs at x = and 4.12 becomes
………………………………………………….4.13
For fully spaced nodal points xi = a + ih, i = 0, 1, ……n and , the max truncation
error using the linear interpolating polynomial P(x) is less than a given > 0, we have
………………………………………….4.14
48
Example1
Using sin(0.1) = 0.09983 and sin(0.2) = 0.19867, find an approximate value of sin (0.15)
by Lagrange’s interpolation, obtain a bound on the truncation error.
Solution
= 0.049915 + 0.099335
= 0.14925
The truncation error is
=
Where ,
The maximum value of is sin 0.2 = 0.19867,
Thus
= (0.00125)(0.19867)
0.00025
Example2
Determine the stepsize h to be used in the tabulation of f(x) = sin x in the interval [1,3] so
that the linear interpolation will be correct to 4 decimal places.
49
Solution
and f(x) = sin x, f’(x) = cos x, f’’(x) = -sin x
,
50
WEEK 7 and 8
1) Least square approximation to find an approximation to a function f(x) given in
tabular form.
2) Evaluate errors of interpolating polynomials.
3) Use divided differences to determine the explicit representation of an interpolating
polynomial.
APPROXIMATION
The existence of a polynomial function P(x) which approximates any continous function
f(x) on a finite interval is guaranteed by the Weierstrass approximation Theorem.
Weierstrass approximation Theorem
If the function f(x) is continuous on a finite interval , then given any ε > 0, there
exists a n = n(ε) and a polynomial P(x) of degree n such that
In order to determine an approximation to f(x) we assume an expression of the form
……………………(1)
Where (i = 0, 1, ………………, n) are independent
functions and the parameter ci (i = 0, 1, ………………, n) are constants to be determined.
The function are called Coordinate Functions which for polynomial approximations
are considered as , (i = 0, 1, ………………, n)
The error of the approximation ε is defined as
……………………….(2)
51
Where is a well defined norm. the aim of approximation is to determine the
coefficient ci (i = 0, 1, ………………, n) inorder that the error is made as small as
possible.
For different types of norm, we obtain different types of approximations. Once a
particular norm is fixed the function which make these error smallest according to this
norm is called the “Best Approximation”.
The most commonly used norms are;
Norm For Discrete Data
a) Lp Norm is defined as
P ≥ 1 ………………………….(3)
b) Euclidean Norm
……………………………………….(4)
written as and is called the square norm.
c) Uniform Norm
……………………………………………(5)
Which is a particular case of (3) for P → ∞.
Norm for Continuous Data
If the function f(x) is continuous in the interval , then the norm is
52
a) , P ≥ 1 ………………………….(6)
Where4 w(x) > 0 and is the weighted function.
b) For p = 2, we have the Euclidean or square norm
………………………………………….(7)
c) For p = ∞, we have the uniform norm.
…………………………………………………….(8)
When we use the Euclidean norm we obtain the Least Square Approximation and when
uniform norm is used we get the Uniform Approximation.
Least Square Approximation
Least Square Approximations are most commonly used approximations for
approximating a function f(x) which may be given in tabular form or known explicitly
over a given interval. In this case we use the Euclidean norm (4). The best approximation
in the least square sense is defined as that for which the constants Ci (i = 0, 1……….., n )
are determined so that the aggregate of the weighted function w(x) over a given interval
is as small as possible for w(x) > 0.
For functions whose values are given at n + 1 points x0, x1, …..xn, we have
………………..(9)
53
For functions which are continuous over the interval
…………………..(10)
Where the coordinate , i = 0, 1, ………., n. and the weight function w(x) = 1.
The necessary condition for equation (9) and (10) to have a minimum value is that
, i = 0, 1, ………., n
This gives a system of n + 1 linear equations in n + 1 unknowns C0, C1…….Cn.
These equations are called the Normal equations.
The normal equations for (9) and (10) are respectively
……………………………(12)
and
, j = 0, 1, 2…….n ….........(13)
Example
Obtain a linear polynomial approximation to the function f(x) = x3 on interval using
the least square approximation with W(x) = 1.
Solution
This equation is continuous hence we use a linear polynomial
P(x) = C0 + C1(x) , where C0 and C1 are arbitrary constants.
54
Using equation (10)
The necessary and sufficient conditions for a minimum to occur is given by equation (11)
Taking the partial derivatives of equation (1) above we have
……………………………………….(2)
Equation (2) is known as the Normal equations.
Solving the normal equations simultaneously, we get
and
The polynomial will be
Example 2
Obtain the least square polynomial approximation of degree 1 and 2 for f(x) = on the
interval .
55
Solution
W(x) = 1.
a) For n = 1
………………………………(1)
The necessary and sufficient conditions for a minimum
……………………………….(a)
…………………………….(b)
Solving Simultaneously (a) and (b) we have
and
b) For n = 2
…………………….(2)
The least square polynomial is of the form
56
…………………………(a)
……………………….(b)
………………………(c)
Rearranging (a), (b) and (c), we have
Solving the above equations simultaneously, we have
, and
TCHEBYSHEV POLYNOMIALS
57
The Tchebyshev polynomial of the 1st kind Tn(x) is defined on the interval are
given by
…………………….(1)
and satisfies the differential equations
……………………………(2)
One independent solution of (2) gives the Tn(x) and the second independent solution
gives Chebyshev’s polynomial of the 2nd kind Un(x).
…………………………(3)
The Tchebyshev polynomial Tn(x) satisfies the recurrence relation
……………………………..(4)
From equation (4)
Thus we have
Thus
58
Properties of Tchebyshev polynomial
1. Tn(x) is a polynomial of degree n and if n is even Tn(x) is an even polynomial and if n
is odd Tn(x) is odd polynomial.
2. Tn(x) has n simple zeros , on the interval .
3. Tn(x) assumes extreme values at n + 1 points and the
extreme value at xk is (-1)k.
4.
5. If Pn(x) is any polynomial of degree n with leading coefficient unity (monomial) and
is the monic Chebyshev polynomial.
6. Tn(x) are orthogonal with respect to the weight function
Example
Using the Chebyshev polynomial, obtain the least squares approximation of second
degree for on .
Solution
59
.
We have
The required approximation is
60
61
WEEK 9 and 10
1) State Chebychev oscillation theorem
2) Chebychev’s polynomial to find an approximation to a function f(x) given in tabular
form.
Theorem(CHEBYSHEV EQUIOSCILLATION)
Let f(x) be continuous on and Pn(x) be the best uniform polynomial approximation.
Denote and . Then tere are at least n + 2
points , where
i.
ii. ……………………(1)
Example
Obtain the Chebychev’s linear polynomial approximation to the function on
.
Solution
P(x) = C0 + C1(x)
and x0 = 0 and x1 = and x2 = 1.
Using (1) we have
62
Thus we have
which gives
, and
The Chebychev’s linear approximation is given by
Question
Obtain the Chebychev’s polynomial approximation of second degree to the function
on .
63
CHOICE OF THE METHOD
1) Understand and use the concept of Extrapolation to the limit.
We have considered various forms of the approximating polynomials. The interpolating
polynomials and the function f(x) agree in value at a set of points xi, i = 0, 1, ….., n
belonging to an interval . We use this interpolating polynomial to determine the
value of f(x) at any point . If , we call it an interpolating problem,
otherwise it is called an extrapolation problem. Normally interpolating problem produce
better results. The same interpolating polynomial can be used for obtaining roots of f(x),
certain order derivatives of f(x) at tabular or non-tabular points, integral of f(x) between
known limits or for any other operation desired on f(x).
For a given set of tabular data, the Lagrange interpolating polynomial can be easily
obtained. In many applications, the exact number of tabular points to be used to achieve a
certain degree of accuracy is not readily known.
WEEK 13 AND 14
i) Students hand in the assignment
ii) Students take sit in course examination.
64