Professional Documents
Culture Documents
Topic 1:
Introduction to Numerical Methods and Taylor Series
Lectures 1-4:
CISE301_Topic1
Lecture 1
Introduction to Numerical Methods
Numerical Methods
Numerical Methods:
Algorithms that are used to obtain numerical
solutions of a mathematical problem.
CISE301_Topic1
What do we need?
Basic Needs in the Numerical Methods:
Practical:
Can be computed in a reasonable amount of time.
Accurate:
CISE301_Topic1
Taylor Theorem
Number
Representation
Solution of nonlinear
Equations
Interpolation
Numerical
Differentiation
Numerical Integration
CISE301_Topic1
Solution of linear
Equations
Least Squares curve
fitting
Solution of ordinary
differential equations
Solution of Partial
differential equations
x2 4x 3 0
Analytic solution roots
4 2 4(1)(3)
2(1)
x 1 and x 3
x 9 2 x 2 5 0
No analytic solution
x
xe
CISE301_Topic1
Bisection Method
Newton-Raphson Method
Secant Method
CISE301_Topic1
3 x 2 2 x2 5
x2 2, x1 3 2 1
What to do if we have
1000 equations in 1000 unknowns.
CISE301_Topic1
1
2
1,
1
2
1
1
x2
1
1
3
5
2
1
2
CISE301_Topic1
10
Curve Fitting
0.5
10.3
21.3
CISE301_Topic1
11
Interpolation
yi
0.5
10.3
15.3
yi P( xi ) if xi is in the table
CISE301_Topic1
12
Least Squares
o
o
Linear Regression
Nonlinear Least Squares Problems
Interpolation
o
o
CISE301_Topic1
13
Integration
1 2
9 1
1 xdx 2 x 1 2 2 4
But many functions have no analytical solutions :
a
x2
dx ?
CISE301_Topic1
14
Trapezoid Method
Romberg Method
Gauss Quadrature
CISE301_Topic1
15
16
u
2
u
2
20
x
t
u (0, t ) u (1, t ) 0, u ( x,0) sin(x)
2
CISE301_Topic1
17
Summary
Numerical Methods:
Algorithms that are
used to obtain
numerical solution of a
mathematical problem.
We need them when
No analytical solution
exists or it is difficult
to obtain it.
CISE301_Topic1
Numerical Integration
Numerical Differentiation
Solution of Ordinary Differential
Equations
Solution of Partial Differential
Equations
18
Lecture 2
Number Representation
Normalized Floating Point Representation
Significant Digits
Accuracy and Precision
Rounding and Chopping
Reading Assignment: Chapter 3
CISE301_Topic1
19
Decimal System:
Standard Representations:
3 1 2 . 4 5
sign integral
part
CISE301_Topic1
fraction
part
20
d . f1 f 2 f 3 f 4 10 n
sign
mantissa
exponent
d 0,
n : signed exponent
CISE301_Topic1
21
Binary System
Binary System:
1. f1 f 2 f 3 f 4 2 n
sign
mantissa
signed exponent
CISE301_Topic1
22
Fact
(1.1)10 (1.000110011001100...)2
CISE301_Topic1
23
Fraction23
Exponent11
Fraction52
(continued)
CISE301_Topic1
24
Significant Digits
25
Remarks
CISE301_Topic1
26
Calculator Example
3.57
2.13 = 7.60
True answer:
CISE301_Topic1
7.653342
27
48.9
CISE301_Topic1
28
CISE301_Topic1
29
CISE301_Topic1
30
CISE301_Topic1
31
CISE301_Topic1
32
33
CISE301_Topic1
34
Notation
We say that the estimate is correct to n
decimal digits if:
n
Error 10
1
n
Error 10
2
CISE301_Topic1
35
Summary
Number Representation
Numbers that have a finite expansion in one numbering system
may have an infinite expansion in another numbering system.
CISE301_Topic1
36
Lectures 3-4
Taylor Theorem
Motivation
Taylor Theorem
Examples
Reading assignment: Chapter 4
CISE301_Topic1
37
Motivation
4.1 , sin(0.6) ?
to compute sin(0.6)?
Is this a practical way?
CISE301_Topic1
0.6
38
Remark
CISE301_Topic1
39
Taylor Series
The Taylor series expansion of f ( x ) about a :
f ( 2) (a )
f ( 3) ( a )
2
f (a ) f (a ) ( x a )
( x a)
( x a ) 3 ...
2!
3!
or
'
Taylor Series
k 0
1 (k )
f (a ) ( x a )k
k!
1 (k )
f ( x ) f (a ) ( x a )k
k!
k 0
CISE301_Topic1
40
Maclaurin Series
( 0 ) 2 f ( 0) 3
f ( 0) f ( 0) x
x
x ...
2!
3!
If the series converge, we can write :
'
( 2)
1 (k )
f ( x ) f ( 0) x k
k!
k 0
CISE301_Topic1
41
f ( x) e x
f ( 0) 1
f ' ( x) e x
f ' ( 0) 1
f ( 2) ( x ) e x
f ( 2 ) ( 0) 1
f (k ) ( x) e x
f ( k ) (0) 1 for k 1
k
2
3
1
x
x
x
e x f ( k ) ( 0) x k
1 x
...
k!
k!
2!
3!
k 0
k 0
42
Taylor Series
3
Example 1
2.5
exp(x)
1+x+0.5x 2
2
1+x
1.5
0.5
0
-1
CISE301_Topic1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
0.8
1
43
f ( x ) sin( x )
f ' ( x ) cos( x )
f ( 0) 0
f ' ( 0) 1
f ( 2 ) ( x ) sin( x )
f ( 2 ) ( 0) 0
f ( 3) ( x ) cos( x )
f ( 3) (0) 1
f ( k ) ( 0) k
x3 x5 x7
sin( x )
x x ....
k!
3! 5! 7!
k 0
The series converges for x .
CISE301_Topic1
44
4
3
2
1
sin(x)
-1
x-x 3/3!
-2
-3
-4
-4
CISE301_Topic1
-3
-2
-1
4
45
f ( x ) cos( x )
f ' ( x ) sin( x )
f ( 0) 1
f ' ( 0) 0
f ( 2 ) ( x ) cos( x )
f ( 2 ) (0) 1
f ( 3) ( x ) sin( x )
f ( 3) (0) 0
2
4
6
f ( k ) ( 0)
x
x
x
cos( x )
( x ) k 1 ....
k!
2! 4! 6!
k 0
46
1
1 x
f ( 0) 1
f ' ( 0) 1
f ( 2 ) ( 0) 2
f ( 3) (0) 6
1
1 x x 2 x 3 ...
1 x
47
Example 4 - Remarks
CISE301_Topic1
48
1
at a 1
x
f (1) 1
f ' (1) 1
f ( 2 ) (1) 2
f ( 3) (1) 6
49
f ' (1) 1,
f ( 2 ) (1) 1
f ( 3) (1) 2
1
2 1
Taylor Series Expansion : ( x 1) ( x 1) ( x 1) 3 ...
2
3
CISE301_Topic1
50
CISE301_Topic1
51
Taylors Theorem
If a function f ( x ) possesses derivative s of orders 1, 2, ..., ( n 1)
on an interval containing a and x then the value of f ( x ) is given by :
k 0
f ( k ) (a )
( x a)k
k!
Rn
Remainder
where :
f ( n 1) ( )
Rn
( x a ) n 1 and is between a and x.
( n 1)!
CISE301_Topic1
52
Taylors Theorem
We can apply Taylor' s theorem for :
1
f(x)
with the point of expansion a 0 if | x | 1.
1 x
If x 1, then the function and its
derivative s are not defined.
Taylor Theorem is not applicable.
CISE301_Topic1
53
Error Term
To get an idea about the approximation error,
we can derive an upper bound on :
( n 1)
( )
Rn
( x a ) n 1
( n 1)!
for all values of between a and x.
f
CISE301_Topic1
54
f ( n ) ( ) e 0.2 for n 1
f ( n 1) ( )
Rn
( x a ) n 1
( n 1)!
e 0.2
n 1
0.2 R3 8.14268E 05
Rn
( n 1)!
CISE301_Topic1
55
k 0
(k )
( x) k
h Rn
k!
( h step size)
( n 1)
( ) n 1
Rn
h
where is between x and x h
( n 1)!
f
CISE301_Topic1
56
57
58
then
and
S S n an 1
59
Then :
1 1
sin(1) 1
3! 5!
1 1 1
sin(1) 1
3! 5! 7!
CISE301_Topic1
60
Example 7
Obtain the Taylor series expansion
of f ( x ) e 2 x 1 at a 0.5 (the center of expansion)
How large can the error be when ( n 1) terms are used
to approximate e 2 x 1 with x 1 ?
CISE301_Topic1
61
2 x 1
f (0.5) e 2
f ' (0.5) 2e 2
f ( 2) (0.5) 4e 2
f ( k ) (0.5) 2 k e 2
f ( k ) (0.5)
( x 0.5) k
k!
k 0
2
k
(
x
0
.
5
)
(
x
0
.
5
)
e 2 2e 2 ( x 0.5) 4e 2
... 2 k e 2
...
2!
k!
CISE301_Topic1
62
n 1 2 1
(1 0.5) n 1
(n 1)!
n 1
(
0
.
5
)
Error 2 n 1
max e 2 1
(n 1)! [ 0.5,1]
e3
Error
(n 1)!
CISE301_Topic1
63