Professional Documents
Culture Documents
Review
Kang ZHOU
1
Numerical
differentiation
Linear algebraic and integration
equations 0.5
0.45
0.4
0.35
0.3
0.25
UV Signal (a.u.)
0.2
0.15
0.1
0.05
4.5 5 5.5
Time (min)
𝐴𝐴 𝑏𝑏 𝑝𝑝 is the only
solution to
𝑅𝑅𝑅𝑅𝑅𝑅𝑅𝑅 𝐴𝐴𝐴𝐴 = 𝑏𝑏
At least one No
Is there any No Is 𝑟𝑟 < 𝑛𝑛 true?
All the solutions can be
inconsistency? solution to 𝐹𝐹
Yes described as 𝑝𝑝 + 𝑤𝑤
Yes 𝐴𝐴𝐴𝐴 = 𝑏𝑏 (𝑝𝑝) −𝐼𝐼
No solution
1 0 0 2 5
row 𝐼𝐼 𝐹𝐹 𝑟𝑟 = 3 0 1 0 3 6 𝑟𝑟 = 𝑚𝑚 < 𝑛𝑛
𝑚𝑚 = 3, 𝑛𝑛 = 5 0 0 1 4 7
elimination*
𝐴𝐴 𝑅𝑅
𝑚𝑚 × 𝑛𝑛 1 0 0
𝐼𝐼 𝑟𝑟 = 3 0 1 0
𝑟𝑟 = 𝑛𝑛 < 𝑚𝑚
0 0 1
[m, n] = size(A);
0 𝑚𝑚 = 4, 𝑛𝑛 = 3 0 0 0
r = rank(A);
r is the same to # of 1 0 0
independent columns of A
𝐼𝐼 𝑟𝑟 = 3 0 1 0 𝑟𝑟 = 𝑛𝑛 = 𝑚𝑚
𝑚𝑚 = 3, 𝑛𝑛 = 3 0 0 1 4
* exchange of columns may be needed
All the rules of rref have been specified here
function A = re4(A) function A = rearrange(A,pi,pj)
pi = 1; [m,n] = size(A); threshold = 1e-10; upper = A(1:pi-1,:);
for pj=1:n [m,n] = size(A);
pivot = A(pi,pj); lower = A(pi:m,:);
if abs(pivot) < threshold column = A(pi:m,pj);
A = rearrange(A,pi,pj); column_abs = abs(column);
end [value,index] = max(column_abs);
pivot = A(pi,pj); memory = lower(1,:);
if abs(pivot) < threshold lower(1,:) = lower(index,:);
continue lower(index,:) = memory;
end A = [upper;lower];
the_row = A(pi,:)/pivot; end
A(pi,:) = the_row;
for i = 1:m
if i ~= pi
A(i,:) = A(i,:) - A(i,pj)*the_row
end
end
if pi == m
break
end
pi = pi + 1;
end
end
5
Iterated algorithms
Iterated algorithms:
Jacobi algorithm
Gauss-Seidel algorithm
Termination condition:
norm(e)/norm(b) < Tol or other conditions
6
Non-linear algebraic equations
Iterated methods for single equation:
Bisection algorithm
Secant algorithm
Newton-Raphson algorithm
7
The three algorithms
5 9 9
2
f(x) = 0.3*x + sqrt(x) - 5
8 8
4
g(x) = 0
7 7
3
6 6
5 5
1
f(x)
f(x)
f(x)
4 4
f(x)
0
3 3
-1
2 2
-2
1 1
-3
0 0
-4 -1 -1
x x x
8
Numerical Differentiation and integration
Both are needed to solve differential equations
They are also useful in engineering applications, such
as calculating reaction rate and peak area.
Numerical
Differentiations
11
ODEs: Initial value problems
How do I know if a system of ODEs are stiff?
12
ODEs: Boundary value problems
Shooting method
Convert BVP into IVP by guessing initial
conditions and check if boundary condition is
met
Finite difference method
Consider value of y at all the grid points to be
unknowns and establish enough algebraic
equations to calculate the values.
We only handle linear ODE(s) in this module
when finite difference method is used.
13
How should I prepare for the exam?
Use tutorial questions and homework questions
14
Comments on exam
Comments in m-file
15
General methodologies of numerical
methods
Approximation (get things started)
Euler method, Vector projection
Represent scattered data by using simple functions
Represent a function by using scattered data
Improve approximation accuracy (get the job done)
Use segments (developing generic model could be difficult)
Reduce step size
Use refinement (Runge-Kutta methods)
16