Anda di halaman 1dari 14

1

CE 205
Numerical Methods
Dr. Charisma Choudhury
Lecture 1
March 30, 2009
Objective
Some of the analysis methods you have
used so far..
Algebra
Calculus
Differential Equations etc.
Often not possible to determine analytical
solution
Complex calculation
Sheer size of problem
2
Why Numerical Methods?
Example:
No closed form solution
Length of one half of the curve y = sin(x):
Large matrices
Computer is not so smart
Need to break the problem to simple mathematical problems
Add, subtract, multiply, divide, compare
Practical considerations
Example: Length of a board derived by solving equation:
x
3
- x
2
- 3x + 3=0
How accurately can we measure for practical applications?
2
0
1 cos ( ) x dx

Course Outline
Numerical solution of algebraic and
transcendental equations
Solution of systems of linear equations
Linear and non-linear curve-fitting by least
square regression
Finite differences
Divided differences
Interpolation
Numerical differentiation and integration
Numerical solution of differential equations
3
Course Outline
Numerical solution of algebraic and
transcendental equations
Solution of systems of linear equations
Linear and non-linear curve-fitting by least
square regression
Finite differences
Divided differences
Interpolation
Numerical differentiation and integration
Numerical solution of differential equations
Lecture Plan
Algebraic and transcendental
equations
Curve-fitting
Differential equations
CE applications and review
5 classes
3 classes
4 classes
1 class
4
References
Any standard undergraduate textbook on
Numerical Methods
Some examples:
Numerical Analysis: Goel & Mittal
Applied Numerical Analysis: Gerald & Wheatley
Numerical Methods for Engineers: Chapra & Canale
Introductory Methods of Numerical Analysis: Sastry
Grading Policy
3 quizzes
Tentatively on 5
th
, 9
th
and 12
th
class
Or maybe one computer programming
assignment?
The last one is only a make-up
quiz/assignment
5
Approach
Often multiple methods for solving same
problem
Which is the most relevant method?
Examine the problem
What inputs do we have?
What accuracy do we need?
What is the computational burden?
What is the rate of convergence?
Errors in Numerical Methods
Error in original data/measurement error
Truncation error: e
x
=1+ x/1! + x
2
/2!+
Round-off error: 1/3, etc.
Calculations errors
significant digits

6
Errors
Abs error = |true-apprx|
Relative= abs error /true
5000+/-0.10
0.005+/-0.1
True=10/3, apprx = 3.333
Abs=1/3000
Rel=1/10000
Significant digits 4
Algebraic and Transcendental
Equations
Algebraic: y =ax+b
Transcendental: y = a sinx+b cosx
7
Solution Methods
Bisection/ Half-interval Search
Method of false position/Regula Falsi
Secant Method
Newton Raphson
Iteration Method
Many more
Choice of Method Depends on ..
Required accuracy
Rate of convergence
Inputs
How does initial approximation affect the
computation?
Often combination of multiple methods is
the optimum
8
Bisection/ Half-interval Search
Background:
Lessons from Graphical approach
Solve: f(x)=0
Let y=f(x)
Take a set of rectangular coordinates within a
range (say x
L
and x
U
)
Plot
Root(s): the point(s) where y crosses x
Background
Different variations (Examples shown
in next page)
Single root
Multiple roots
No root within specified range
9
1 root
3 roots
no roots
2 roots
Background
Observations
If f(x
l
) and f(x
U
) have opposite signs
Odd number of roots in between
If f(x
l
) and f(x
U
) have same signs
Zero/even number of roots in between
Exceptions
Discontinuous function
10
Discontinuous Function
Deductions
If f(x) is
continuous between x
L
and x
U
and
f(x
l
) * f(x
U
) <0
(i.e. f(x
l
) and f(x
U
) have opposite signs)
There is at least 1 real root f(x)=0 between
x
L
and x
U
11
Example
Tangential functions
can have any number of roots even
irrespective of sign change/unchange
Deductions
If f(x) is
continuous and strictly monotonic between
x
L
and x
U
and
f(x
l
) * f(x
U
) <0
(i.e. f(x
l
) and f(x
U
) have opposite signs)
There is atmost 1 real root f(x)=0 between
x
L
and x
U
12
Basis of Bisection Method
Narrow down interval [f(x
L
) and f(x
U
) ]to
locate where the sign change occurs
Divide into equal sub-intervals to search
the point where the sign change occurs
Steps
Choose x
L
and x
L
such that f(x
L
)*f(x
U
)<0
Initial estimate of root x
R
=(x
L
+ x
U
)/2
f(x
R
)*f(x
L
)<0, root is in lower interval,
replace x
U
by x
R
f(x
R
)*f(x
L
)>0, root is in upper interval,
replace x
L
by x
R
Terminate when f(x
R
)=f(x
L
) or
f(x
U
)-f(x
L
)<tolerance
13
Example
f(x)=x
3
-x-1
x
L
=1,x
U
=2
x
R
=1.5
Solution: x=1.324
xL xR xU f(xL) f(xR) f(xU) DifferenceRemark
1.0000 1.5000 2.0000 -ve +ve +ve 1.0000 replace upper
1.0000 1.2500 1.5000 -ve -ve +ve 0.5000 replace lower
1.2500 1.3750 1.5000 -ve +ve +ve 0.2500 replace upper
1.2500 1.3125 1.3750 -ve -ve +ve 0.1250 replace lower
1.3125 1.3438 1.3750 -ve +ve +ve 0.0625 replace upper
1.3125 1.3281 1.3438 -ve +ve +ve 0.0313 replace upper
1.3125 1.3203 1.3281 -ve -ve +ve 0.0156 replace lower
1.3203 1.3242 1.3281 -ve -ve +ve 0.0078 replace lower
1.3242 1.3262 1.3281 -ve +ve +ve 0.0039 OK at 0.01 tolerance
Note:
OK at 0.01 tolerance. Not ok at 0.001 tolerance, need more iterations.
14
Practice Problems
. ( )
2
. 2
x
x
x
a e Sin
b xe

=
=
Find roots of the following in bisection
method

Anda mungkin juga menyukai