0% found this document useful (0 votes)
78 views

Lecture 1: Module Overview: Zhenning Cai August 15, 2019

This document provides an overview of the MA2213: Numerical Analysis I module, which introduces numerical approximation techniques. 10 examples are given to illustrate the following topics: [1] Computer arithmetic and computational error, [2] Solution of linear systems of equations, [3] Interpolation and least squares approximation, [4] Numerical integration, and [5] Solution of nonlinear equations. C code examples are included to demonstrate numerical methods for approximating integrals, solving systems of equations, and fitting data.

Uploaded by

Liu Jianghao
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Lecture 1: Module Overview: Zhenning Cai August 15, 2019

This document provides an overview of the MA2213: Numerical Analysis I module, which introduces numerical approximation techniques. 10 examples are given to illustrate the following topics: [1] Computer arithmetic and computational error, [2] Solution of linear systems of equations, [3] Interpolation and least squares approximation, [4] Numerical integration, and [5] Solution of nonlinear equations. C code examples are included to demonstrate numerical methods for approximating integrals, solving systems of equations, and fitting data.

Uploaded by

Liu Jianghao
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MA2213: Numerical Analysis I

Lecture 1: Module overview

Zhenning Cai

August 15, 2019

This module introduces the basic theory and applications of numerical approximation
techniques. The following topics are to be included:

• Computer arithmetic and computational error


• Solution of linear systems of equations
• Interpolation and least squares approximation
• Numerical integration
• Solution of nonlinear equations

Below we are going to give an overiew for each part by examples.

1 Computer arithmetic and computational error


Example 1. Define a function f (x) = ex − (1 + x), where e is Euler’s number. We compute

f (f (x)) (1)

by the following C code:


# include < stdio .h >
# include < math .h >

float func ( float x ) {


return expf ( x ) - (1+ x ) ;
}

int main ()
{
printf ( " %.10 f \ n " , func ( func (0.1) ) ) ;
return 0;
}

The output is 0.0000133514. How reliable is the result?


The exact value of (1) is
0.0000133922703665 · · ·
Where does the error come from?

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;

float summand = sqrt ( x ) ;


float result = sqrt ( M_PI ) - 2 * summand ;
int k ;
for ( k = 1; k <= n ; k ++)
result -= ( summand *= -x / k ) / ( k + 0.5) ;
printf ( " % f \ n " , result ) ;

return 0;
}

The output is 0.562796. How reliable is this result?

2 Solution of linear systems of equations


Example 3. Consider the equations

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)

exist? If so, how to find x?

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?

3 Interpolation and least squares approximation


Example 5. The following table gives the population (in millions) of Singapore since 1960:
Year 1960 1965 1970 1975 1980 1985 1990 1995 2000 2005 2010 2015
Population 1.646 1.887 2.074 2.263 2.414 2.736 3.047 3.525 4.028 4.266 5.077 5.535

Based on the above data, can we estimate the population in 1997?


We plot these data as a graph and connect the data points:

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 ?

5 Solution of nonlinear equations


Example 9. A container with length L = 10cm has a semi-circular cross section with radius
r = 2.5cm. Suppose the container is filled with liquid with volume 60cm3 . What is the height
of the liquid?

Suppose the height of the liquid is h. Then its volume is


∫ h √ ( )
1 2 r−h √
V = L r − (r − x) dx = L
2 2 πr − r arcsin
2
− (r − h) r − (r − h) .
2 2
0 2 r
Given V , L and r, how can we solve h?
Example 10. We would like to hit an object by shooting a projectile. Suppose the landing
point x is a function of the initial launch angle θ, and the target locates at point x0 . We want
to solve the equation
x(θ) = x0 .
For a given θ, the evaluation of x(θ) requires an experiment or a computer simulation,
which may be expensive or time-consuming. How can we design the numerical algorithm?

4
θ
x0 x

You might also like