MEC503 Lecture3
MEC503 Lecture3
The MATLAB command for a Taylor polynomial is taylor(f,n+1,a), where f is the function, a is the
point around which the expansion is made, and n is the order of the polynomial.
Example 2.1.1 Use zero- through fourth-order Taylor series expansions to approximate the function:
𝑓 (𝑥) = −0.1𝑥 4 − 0.15𝑥 3 − 0.5𝑥 2 − 0.25𝑥 + 1.2
at x = 0 by zero-order, first-order, and second-order Taylor series expansions.
Matlab Code:
clc;clear ;close all
syms x f
f=-0.1*x^4-0.15*x^3-0.5*x^2-0.25*x+1.2;
fplot(f,[0 1]);xlabel(’x’);ylabel(’f(x)’)
set(gcf,’color’,’w’);
hold on
for n=0:4;
H=taylor(f,’Order’,n+1,’expansionpoint’,0);
fplot(H,[0 1])
end
2-1
2-2
2.2 FINITE DIFFERENCE (cont)
there are two ways to improve derivative estimates when employing finite divided differences: (1) decrease
the step size or (2) use a higher-order formula that employs more points.
some other properties of finite difference equations (FDE).
1. The partial differential equation (PDE) consistences with the finite difference equation (FDE) when the
difference between PDE and FDE is small (Δ𝑥 is small) as the grid spacing goes to zero.
2. Convergence: The FDE solution is convergent as the difference between two successive processes
vanishes as the grid spacing goes to zeros. (approaching the exact solution).
3. Order: The rate at which FDE are approximated becomes small as the grid spacing goes to zero.
𝜕3𝑢
Example 2.2.1 Find the central difference approximation of (Δ𝑥) 2 for 𝜕𝑥 3
.
2 3 4
𝑓 (𝑥 + Δ𝑥) = 𝑓 (𝑥) + 𝑓 0 (𝑥)Δ𝑥 + 𝑓 00 (𝑥) (Δ𝑥) 000 (Δ𝑥)
2! + 𝑓 (𝑥) 3! + 𝑓
0000 (𝑥) (Δ𝑥) + 𝑂 (Δ𝑥) 5
4! (1)
2 (Δ𝑥) 3 4
𝑓 (𝑥 − Δ𝑥) = 𝑓 (𝑥) − 𝑓 0 (𝑥)Δ𝑥 + 𝑓 00 (𝑥) (Δ𝑥) 000
2! − 𝑓 (𝑥) 3! + 𝑓
0000 (𝑥) (Δ𝑥) − 𝑂 (Δ𝑥) 5
4! (2)
2 (2Δ𝑥) 3 4
𝑓 (𝑥 + 2Δ𝑥) = 𝑓 (𝑥) + 𝑓 0 (𝑥)(2Δ𝑥) + 𝑓 00 (𝑥) (2Δ𝑥) 000
2! + 𝑓 (𝑥) 3! + 𝑓
0000 (𝑥) (2Δ𝑥) + 𝑂 (Δ𝑥) 5
4! (3)
2 (2Δ𝑥) 3 4
𝑓 (𝑥 − 2Δ𝑥) = 𝑓 (𝑥) − 𝑓 0 (𝑥)(2Δ𝑥) + 𝑓 00 (𝑥) (2Δ𝑥) 000
2! − 𝑓 (𝑥) 3! + 𝑓
0000 (𝑥) (2Δ𝑥) − 𝑂 (Δ𝑥) 5
4! (4)
Now, (3) - (4) -2((1)-(2) to get:
4. Navier-Stokes Equation.
2-3
★ The order of PDE is determined by the highest derivative in the equation.
★ Linear/Nonlinear: A partial differential equation is said to be linear if it is linear in the unknown function
and all its derivatives, with coeffcients depending only on the independent variables. call it nonlinear.
Here we consider how to classify partial differential equations, now consider the equation:
𝜕 2𝑢 𝜕 2𝑢 𝜕 2𝑢
𝐴 + 𝐵 + 𝐶 +𝐷 =0
𝜕𝑥 2 𝜕𝑥𝜕𝑦 𝜕𝑦 2
𝜕2 𝑓 2
Example 2.4.1 Laplace equation ∇2 𝑓 = 0 ⇒ 𝜕𝑥 2
+ 𝜕𝜕𝑦2𝑓 = 0 compare the PDE with general form:
𝜕 2𝑢 𝜕 2𝑢 𝜕 2𝑢
𝐴 + 𝐵 + 𝐶 + 𝐷 = 0, gives, 𝐴 = 1, 𝐵 = 0, 𝐶 = 1, 𝐷=0
𝜕𝑥 2 𝜕𝑥𝜕𝑥 𝜕𝑦 2
The characteristic equation 𝐵2 − 4𝐴𝐶 = 0 − 4(1)(1) = −4 < 0
𝜕2 𝑓 𝜕2 𝑓
The two dimensional Laplace equation 𝜕𝑥 2
+ 𝜕𝑦 2
= 0 is elliptic PDE equation.
𝜕𝑓 2 2
Example 2.4.2 One dimensional heat equation 𝜕𝑡 = 𝛼 𝜕𝜕𝑥 2𝑓 ⇒ 𝜕𝑓
𝜕𝑡 − 𝛼 𝜕𝜕𝑥 2𝑓 = 0 compare the PDE
with general form:
𝜕 2𝑢 𝜕 2𝑢 𝜕 2𝑢
𝐴 + 𝐵 + 𝐶 + 𝐷 = 0, gives, 𝐴 = −𝛼, 𝐵 = 0, 𝐶 = 0, 𝐷=1
𝜕𝑥 2 𝜕𝑥𝜕𝑥 𝜕𝑦 2
𝑎 1 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
𝜕𝑥 + 𝑏 1 𝜕𝑦 + 𝑐 1 𝜕𝑥 + 𝑑 1 𝜕𝑦 = 𝑓1
𝑎 2 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
𝜕𝑥 + 𝑏 2 𝜕𝑦 + 𝑐 2 𝜕𝑥 + 𝑑 2 𝜕𝑦 = 𝑓2
For a first-order PDE, the characteristics curves along which the PDE becomes an ordinary differential
𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
equation (ODE). To find such line, add the the two equations 𝑑𝑢 = 𝜕𝑥 𝑑𝑥 + 𝜕𝑦 𝑑𝑦 and 𝑑𝑣 = 𝜕𝑥 𝑑𝑥 + 𝜕𝑦 𝑑𝑦 to
2-5
the system, now we have:
𝑎 1 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
𝜕𝑥 + 𝑏 1 𝜕𝑦 + 𝑐 1 𝜕𝑥 + 𝑑 1 𝜕𝑦 = 𝑓1
𝑎 2 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
𝜕𝑥 + 𝑏 2 𝜕𝑦 + 𝑐 2 𝜕𝑥 + 𝑑 2 𝜕𝑦 = 𝑓2
𝜕𝑢 𝜕𝑢
𝜕𝑥 𝑑𝑥 + 𝜕𝑦 𝑑𝑦 = 𝑑𝑢
𝜕𝑣 𝜕𝑣
𝜕𝑥 𝑑𝑥 + 𝜕𝑦 𝑑𝑦 = 𝑑𝑣
These equations can be written in matrix form:
𝑎 𝑏1 𝑐 𝑑 𝜕𝑢 𝑓 𝑎 𝑏1 𝑐 𝑑
1 1 1 𝜕𝑥 1 1 1 1
𝜕𝑢
𝑎 2 𝑏2 𝑐 2 𝑑2 𝜕𝑦 𝑓2 𝑎 2 𝑏2 𝑐 2 𝑑2
𝑑𝑥 𝑑𝑦 0 0 𝜕𝑣 = 𝑑𝑢 ⇒ [ 𝐴] [Φ] = [𝐵], [ 𝐴] ≡
𝑑𝑥 𝑑𝑦 0 0
𝜕𝑥
0 0 𝑑𝑥 𝑑𝑦 𝜕𝑣 𝑑𝑣 0 0 𝑑𝑥 𝑑𝑦
𝜕𝑦
Using Cramer’s rule: to find the first unknown in matrix Φ, replace the first column of [A] by [B] and find
the determinant of the resultant matrix divided by the determinant of the original [A], such that:
𝑓 𝑏1 𝑐 1 𝑑1
1
𝑓2 𝑏2 𝑐 2 𝑑2
𝑑𝑢
𝑑𝑦 0 0 𝑎 𝑏1 𝑐 𝑑
1 1 1
0 𝑑𝑥 𝑑𝑦
𝜕𝑢 𝑑𝑣 𝑎 2 𝑏2 𝑐 2 𝑑2
= By definition of the characteristic line, |A|=0. | 𝐴| = =0
𝜕𝑥 𝑎 1 𝑑𝑥 𝑑𝑦 0 0
𝑏1 𝑐 1 𝑑1
𝑎2
𝑏2 𝑐 2 𝑑2 0 0 𝑑𝑥 𝑑𝑦
𝑑𝑥
𝑑𝑦 0 0
0 0 𝑑𝑥 𝑑𝑦
we are interested only in the slop of the characteristic line which is:
√
𝑑𝑦 −𝑏 ± 𝑏 2 − 4𝑎𝑐
= , The dscriminant D , 𝐷 = 𝑏 2 − 4𝑎𝑐
𝑑𝑥 2𝑎
The mathematical classification of the given system of PDE is determined by the value of D:
If 𝐷 > 0 Two real and distinct characteristics exist through each point in the xy plane. The system of
PDE equations is called hyperbolic
If 𝐷 = 0 Here the system of PDE equations is called parabolic
If 𝐷 < 0 Characteristic lines are imaginary . The system of PDE equations is called elliptic