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 eigenval
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 + + an
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 d
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
Chapter 1
Error Analysis
1.2 Roundoff Error and Computer Arithmetic
By the IEEE Binary Floating Arithmetic
Standard 754-2008, numbers in
computers are represented by 64 binary
digits (64 bits) in the
Analysis
k-p
- +
Propagation of Errors
Trick to Avoid Subtractions b/w Close No.
Nested Arithmetic (to reduce errors)
1.3 Algorithm
Frequently Used Languages
Decimal Machine Numbers
Absolute and Relative Errors
Significant Digits
Relative Error for Chopping
Relative Error for Rounding
Finite Digit Arithmetic
Arithmetic b/w Big and Small Numbers
Subtraction
Chapter 2: Root Finding
The Needs for Root Finding
2.1 The Bisection Method
Theorem 1.13
P.9
f ( x) = 0
is based on Intermediate Value Theorem :
IF f c[a, b] and f ( a ) < K < f (b)
THEN there exists
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 , t
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 numeri
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
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
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
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
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
)(
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 approxi
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
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
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 ma
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 p
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 e
2.2: Fixed-Point Iteration
Definition of Fixed-Point:
g ( p ) = p, p is a fixed point for g
Example :
g ( x) = x 2 2, for 2 x 3
has fixed points at x = 1 and x = 2
since g (1) = (1) 2 2 = 1
g (2) = 2