MATH3311 T2
Tutorial-9
I. Taylor theorem
Let the function f : [a , b ] be n+1 times differentiable on [a,b]. Then for every x , c [ a , b ] ,
there exists
(n )
f ( x )= f ( c )+ f ' ( c ) ( x c )+
(n + 1)
f ' '( c )
f (c )
( )
2
(n ) f
( n+ 1 )
, where [
Chapter 5
Integration
We want to construct numerical algorithms that can perform denite integrals
of the form
b
I=
f (x)dx.
(5.1)
a
Calculating these denite integrals numerically is been called numerical integration, numerical quadrature, or more simply q
Chapter 4
Interpolation
Consider the following problem: Given the values of a known function y = f (x)
at a sequence of ordered points x0 , x1 , . . . , xn , nd f (x) for arbitrary x. When
x0 x xn , the problem is called interpolation. When x < x0 or x >
38
Chapter 6
Ordinary dierential
equations
We now discuss the numerical solution of ordinary dierential equations. These
include the initial value problem, the boundary value problem, and the eigenvalue problem. Before proceeding to the development of num
Chapter 3
Systems of equations
Consider the system of n linear equations and n unknowns, given by
a11 x1 + a12 x2 + + a1n xn = b1 ,
a21 x1 + a22 x2 + + a2n xn
.
.
.
= b2 ,
.
.
.
an1 x1 + an2 x2 + + ann xn = bn .
We can write this system as the matrix equa
54
Chapter 7
Least-squares
approximation
The method of least-squares is commonly used to t a parameterized curve to
experimental data. In general, the tting curve is not expected to pass through
the data points, making this problem substantially dierent f
Introduction to Numerical Methods
Tutorial-2
Name:
Wang Ruijie (Lain)
Tel:
68781273
Homepage: http:/ihome.ust.hk/~rwangab/
Outline
Using script M-file
Functions and function M-file
Operator precedence
Flow control - conditional statement
Using script M-fi
MATH3311 T2
Tutorial-6
I. Piecewise linear interpolation
The concept of piecewise linear interpolation is to connect each
two points by a local linear polynomial. The derivative is not
continuous at each point.
Example:
Consider three points (0,0), (1,0.8
MATH3311 T2
Tutorial-13
I. Numerical ODE - Mixed boundary condition
In the lecture notes, there are examples of mixed boundary condition for eigenvalue problem.
Here is an example for boundary value problem.
Example 1 : Consider a heat conduction problem
MATH3311 T2
Tutorial-4
Part I. Analysis and programming
First I will talk about global variable. See the following example
function declare_global()
global global_var
global_var = 1
show_global()
end
function show_global()
global global_var
global_var
end
MATH3311 T2
Tutorial-7
This is only a brief summary of Chapter 1-4, according to the lecture. I will also talk about some
homework problems and answer questions about Chapter 1-4. For Matlab part, if you feel the
code for root-finding is difficult, you ca
MATH3311 T2
Tutorial-8
This is the solution for Midterm, I will talk about integration and some question in HW4 next
time. The final exam may have similar questions.
Question 1
(a) The multiplication and division have the same operator precedence, Matlab
MATH3311 T2
Tutorial-5
Part I. System of nonlinear equations
First, Let's solve a simple problem by hand computation. Consider
iteration equation (
(
f ( x , y )= x y
, the
2
g ( x , y) = x 2x y +2
)( ) ( )
f x f y xn f
) then becomes
=
g x g y y n g
(
)(
MATH3311 T2
Tutorial-12
I. BVP - Finite difference method
When using the Finite difference method, one discrete the original ODE by replacing the
derivatives with approximate finite difference approximation. For the equations(first and last)
containing th
MATH3311 T2
Tutorial-10
I. Adaptive integration
This is the algorithm used by Matlab. Let's see a simple case for illustration.
3
x
Example: Suppose the integration is I =0 e dx , and adaptive Simpson's rule is used. The
tolerance is 1.0E-2.
The exact val
MATH3311 T2
Tutorial-11
I. More on Runge-Kutta method
Classical forth-order Runge-Kutta method is commonly used in numerical computation
k 1= t f ( t n , x n )
1
1
k 2= t f ( t n+ t , x n + k 1)
2
2
1
1
k 3 = t f ( t n + t , x n + k 2)
2
2
k 4= t f ( t n
Chapter 2
Root Finding
Solve f (x) = 0 for x, when an explicit analytical solution is impossible.
Bisection
The bisection method is the easiest to numerically implement and almost always
works. The main disadvantage is that convergence is slow. If the bis