You are on page 1of 5

MEC503 Computer Techniques February 9, 2022

Lecture 2: PARTIAL DIFFERENTIAL EQUATIONS


University of Mosul Younis Najim Dep. of Mechanical Engineering

2.1 TAYLOR SERIES IN MATLAB

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:

𝑓 (𝑥 + 2Δ𝑥) − 𝑓 (𝑥 − 2Δ𝑥) − 2[ 𝑓 (𝑥 + Δ𝑥) − 𝑓 (𝑥 − Δ𝑥)] = 𝑓 000 (𝑥)(2)(Δ𝑥) 3 + (Δ𝑥) 5 , ⇒


𝑓 (𝑥+2Δ𝑥)− 𝑓 (𝑥−2Δ𝑥)−2[ 𝑓 (𝑥+Δ𝑥)− 𝑓 (𝑥−Δ𝑥)]
𝑓 000 (𝑥) = 2(Δ𝑥) 3
+ (Δ𝑥) 2

2.3 DEFINITIONS OF PARTIAL DIFFERENTIAL EQUATION (PDE)


A partial differential equation (PDE) is an equation that contains one or more partial derivatives of an
unknown function that depends on at least two variables.
suppose that a function u = u(x1, x2, . . . , xn), a partial differential equation (PDE) in u is an equation
which relates any of the partial derivatives of u to each other and/or to any of the variables x1, x2, . . . , xn
and u.
𝜕𝑢 𝜕  𝜕𝑢  𝜕 2𝑢
𝑢𝑥 = , 𝑢 𝑥𝑦 = ≡
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑥𝜕𝑦
Here 𝑢 is called unknown. x and y are the independent variables.
The most important PDEs are:
𝜕2𝑢 2 𝜕 2 𝑢 is one dimensional wave equation.
1. The wave equations that can model the vibrating string, 𝜕𝑡 2 = 𝑐 𝜕𝑥 2
𝜕𝑢 2 𝜕2𝑢
2. The heat equation for temperature in a bar or wire, 𝜕𝑡 = 𝛼 𝜕𝑥 2 is one dimensional heat equation.
𝜕2𝑢 𝜕2𝑢
3. The Laplace equation for electrostatic potentials, 𝜕𝑥 2 + 𝜕𝑦 2
= 0, is two-dimensional Laplace equation.
The Laplace operator:

𝜕2 𝜕2 𝜕2 𝜕2Φ 𝜕2Φ 𝜕2Φ


∇2 = + + , ∇2 Φ = + +
𝜕𝑥 2 𝜕𝑦 2 𝜕𝑧 2 𝜕𝑥 2 𝜕𝑦 2 𝜕𝑧 2

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.

2.4 CLASSIFICATION OF PDEs

2.4.1 SINGLE PARTIAL DIFFERENTIAL EQUATION

Here we consider how to classify partial differential equations, now consider the equation:

𝜕 2𝑢 𝜕 2𝑢 𝜕 2𝑢
𝐴 + 𝐵 + 𝐶 +𝐷 =0
𝜕𝑥 2 𝜕𝑥𝜕𝑦 𝜕𝑦 2

where A, B, and C are functions of x and y and D is a function of x, y, u, 𝜕𝑢


𝜕𝑥 ,
𝜕𝑢
𝜕𝑦 . Depending on the values
of A, B, C and D, the PDE can be classified into one of three categories:
1. Parabolic: → 𝐵2 − 4𝐴𝐶 = 0, for example Heat conduction equation.
2. Elliptic: → 𝐵2 − 4𝐴𝐶 < 0, for example Laplace equation.
3. Hyperbolic: → 𝐵2 − 4𝐴𝐶 > 0, for example Wave equation.

𝜕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

The characteristic equation 𝐵2 − 4𝐴𝐶 = 0 − 4(−𝛼)(0) = 0


𝜕𝑓 2
The one dimensional heat equation 𝜕𝑡 = 𝛼 𝜕𝜕𝑥 2𝑓 is parabolic PDE equation.
2-4
2.4.2 CLASSIFICATION OF QUASI-LINEAR PDEs

Let’s consider system of quasi-linear system of equations:

𝑎 1 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
𝜕𝑥 + 𝑏 1 𝜕𝑦 + 𝑐 1 𝜕𝑥 + 𝑑 1 𝜕𝑦 = 𝑓1
𝑎 2 𝜕𝑢 𝜕𝑢 𝜕𝑣 𝜕𝑣
𝜕𝑥 + 𝑏 2 𝜕𝑦 + 𝑐 2 𝜕𝑥 + 𝑑 2 𝜕𝑦 = 𝑓2

where u and v are dependent variable, function of x, y and the coefficients 𝑎 1 , 𝑏 1 , 𝑐 1 , 𝑑1 , 𝑎 2 , 𝑏 2 , 𝑐 2 , 𝑑2


can be function of x,y,u and v.
now let’s consider a point P on a line along with the derivatives of u and v are indeterminant and cross
which may be discontinuous. This lines is called characteristic line

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 𝑑𝑥 𝑑𝑦

(𝑎 1 𝑐 2 − 𝑎 2 𝑐 1 ) (𝑑𝑦) 2 − (𝑎 1 𝑑2 − 𝑎 2 𝑑1 + 𝑏 1 𝑐 2 − 𝑏 2 𝑐 1 )𝑑𝑥𝑑𝑦 + (𝑏 1 𝑑2 − 𝑏 2 𝑑1 )(𝑑𝑥) 2 = 0 divide by (𝑑𝑥) 2


 𝑑𝑦  2 𝑑𝑦
(𝑎 1 𝑐 2 − 𝑎 2 𝑐 1 ) − (𝑎 1 𝑑2 − 𝑎 2 𝑑1 + 𝑏 1 𝑐 2 − 𝑏 2 𝑐 1 ) + (𝑏 1 𝑑2 − 𝑏 2 𝑑1 ) = 0
𝑑𝑥 𝑑𝑥
let 𝑎 = (𝑎 1 𝑐 2 −𝑎 2 𝑐 1 ), 𝑏 = −(𝑎 1 𝑑2 −𝑎 2 𝑑1 +𝑏 1 𝑐 2 −𝑏 2 𝑐 1 ), 𝑐 = (𝑏 1 𝑑2 −𝑏 2 𝑑1 ), which can be rewritten as
 𝑑𝑦  2 𝑑𝑦
𝑎 +𝑏 +𝑐 =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

You might also like