Numerical Methods and Computation MTL 107
Numerical Methods and Computation MTL 107
MTL 107
Course Website
https://sites.google.com/view/kporwal/teaching/mtl107
Outline of today’s Lecture
Experiments Theory
Experiments Theory
Computing
▶ Introduction
▶ Calculus and Linear Algebra Review
▶ Roundoff Errors
▶ Nonlinear equations in One Variables
▶ Direct Methods for Linear Systems
▶ Iterative Methods for Linear Systems
▶ Iterative methods for systems of nonlinear equations
Course Plan (Part 2: Prof. Kamana Porwal)
▶ Interpolations
▶ Least Square Approximation
▶ Numerical Differentiation
▶ Numerical Integration
▶ Numerical Methods for Ordinary Differential equations: Initial
Value Problems.
Focus of the Course
1. Minor 30 %
2. Major 70 %
MATLAB
▶ Limit
▶ Continuity
▶ Differentiability
▶ Riemann Integrability
▶ ..... and related basic results about the real valued functions.
Calculus Review
f (n)
f (x) = f (x0 ) + f ′ (x0 )(x − x0 ) + · · · + (x − x0 )n + Rn
n!
f (n+1) (x1 )
where Rn = (n+1)! (x − x0 )n+1 .
Lecture 2
Introduction to Numerical Methods
Course Website
https://sites.google.com/view/kporwal/teaching/mtl107
Numerical Methods and Errors
1 x = 0; h = 1/10;
2 while x<1,
3 x=x+h;
4 % do something depending on x
5 end
Measure of Errors
h2 ′′
f (x0 + h) = f (x0 ) + hf ′ (x0 ) + f (ξ), x0 < ξ < x0 + h.
2
▶ Rearranging:
f (x0 + h) − f (x0 ) h ′′
f ′ (x0 ) = − f (ξ)
h 2
▶ Discretization error is,
0
10
−5
10
Absolute error
−10
10
−15
10 −20 −15 −10 −5 0
10 10 10 10 10
h
▶ f = O(g ) if,
|f (n)|
lim sup <∞
n→∞ |g (n)|
▶ For errors: f = O(hp ) if,
|e|
lim sup <∞
h→0 hp
Small-o
▶ f = o(g ) if,
|f (n)|
lim =0
n→∞ |g (n)|
▶ For errors: f = o(hp ) if,
|e|
lim =0
h→0 hp
Θ notation
The Θ notation signifies a stronger relation then O: A function
ϕ(h) for small h is Θ(ψ(h)) is ϕ is asymptotically bounded both
above and below by ψ.
|f (n)| |f (n)|
0 < lim inf ≤ lim sup <∞
n→∞ |g (n)| n→∞ |g (n)|
▶ Stable Algorithm
A stable algorithm
▶ Unstable Algorithm
An unstable algorithm
Note that,
1
x n + 10x n−1 1
Z
yn + 10yn−1 = dx =
0 x + 10 n
and
1
1
Z
y0 = dx = log(11) − log(10)
0 x + 10
En ≈ c1n E0 ,
Course Website
https://sites.google.com/view/kporwal/teaching/mtl107
In this Section
▶ Understand how numbers are stored in computer.
▶ How Roundoff error can accumulates.
▶ Some recipes to avoid them.
Introduction I
↵n := 2⇡
n
Fn = cos ↵2n si
↵n ↵n
An = nFn6:=Area
Figure n cos sin
of the Circle ! ⇡ as n ! 1
2 2
[See Gander, Gander, & Kwok: Scientific Computing. Springer. Com
Computation of Pi
▶ Define αn = 2π αn αn
n , then area of the triangle is Fn = cos 2 sin 2 .
▶ Area An covered by rotating this triangle n times is
n cos α2n sin α2n
▶ An → π as n → ∞.
n
▶ An = 2 sin( 2π
n )=
n
2 sin(αn )
q q √
1−cos(αn ) 1− 1−sin2 αn
▶ sin(α2n ) = sin α2n = 2 = 2 .
√
▶ sin(α6 ) = 3
2
Computation of Pi