Lecture 1: Module Overview: Zhenning Cai August 15, 2019
Lecture 1: Module Overview: Zhenning Cai August 15, 2019
Zhenning Cai
This module introduces the basic theory and applications of numerical approximation
techniques. The following topics are to be included:
f (f (x)) (1)
int main ()
{
printf ( " %.10 f \ n " , func ( func (0.1) ) ) ;
return 0;
}
Example 2. Define ∫ +∞
g(x) = t−1/2 e−t dt.
x
We want to find the value of g(0.5).
1
By Taylor expansion, we have
√ ∑
+∞
(−1)k xk+1/2
g(x) = π− .
k!(k + 1/2)
k=0
Therefore we can approximate the value of g(x) by truncating the above series. The following
C code implement this algorithm for truncation up to k = 3.
# include < stdio .h >
# include < math .h >
int main ()
{
float x = 0.5;
int n = 3;
return 0;
}
x1 + x2 + 3x4 = 4,
2x1 + x2 − x3 + x4 = 4,
3x1 − x2 − x3 + 2x4 = −3,
−x1 + 2x2 + 3x3 − x4 = 4.
How to use the computer to solve them? More generally, for any n × n matrix A and n-
dimensional vector b, does the solution of the equations
Ax = b (2)
Example 4. How many operations are required to solve x from (2)? If we want to solve (2)
many times with different right-hand sides b, how to design an efficient algorithm?
2
5
0
1960 1970 1980 1990 2000 2010
The population in 1997 can be read off from the graph, and the value is 3.726. We can also
join these data points with a smoother curve:
0
1960 1970 1980 1990 2000 2010
which shows a different estimation: 3.765. The actual value of the population in 1997 is 3.796.
The second estimation is more accurate.
In general, how can we draw a “smooth curve” connecting all the data points?
Example 6. In the following figure, blue circles are the experimental data for the thickness
of shock structure with different Mach numbers. The data have noise. Can we find a smooth
function to fit the noisy data?
0.30
0.25
0.20
Shock thickness
0.15
0.10
0.05
0.00
2 4 6 8 10
Mach number
4 Numerical integration
Example 7. The motion of a simple pendulum can be described by the following ordinary
differential equation:
d2 θ g
+ sin θ = 0,
dt2 ℓ
where g is the gravitational acceleration, ℓ is the length of the pendulum, and θ is the angular
displacement.
The solution θ(t) is a periodic function. The period is
√ ∫
ℓ π/2 1
T =4 √ du,
g 0 1 − sin (θ0 /2) sin2 u
2
3
where θ0 is the maximum angle displacement. However, the above integral cannot be computed
explicitly. How can we get an approximation of T ?
mg sin θ
θ
mg
Example 8. We would like to measure the average speed for a section of a river:
∫ b
1
V = v(x) dx,
b−a a
where the interval [a, b] is the section we are concerned about, and v(x) is the speed of the
river at point x. The value of v(x) can only be obtained by experiment. By each experiment,
we can obtain the value of v(x) for one specific x. Suppose we want to approximate V by 10
experiments. How can we design the experiments to get a good approximation of V ?
4
θ
x0 x