MTH646 Mid-Term Handout
MTH646 Mid-Term Handout
Lecture No. 01
Introduction:
In Mathematics, a partial differential equation is one of the types of differential equations, in which the
equation contains unknown multi variables with their partial derivatives. It is a special case of an ordinary
differential equation.
Many world related problems in applied sciences, physics and engineering are modeled mathematically
with partial differential equations.
In numerical simulation, it is important to find out the exact solutions of partial differential equations but
unfortunately we do not have appropriate methods to find the exact analytical solution of many types of
partial differential equations. In this situation we utilize different approximations and other techniques to
solve the problem numerically. There are several numerical methods are available in literature that help us
to understand the mechanism and complexity of the differential problems.
Definition Partial Derivative:
Let be a function of independent variables i.e. . The partial derivative of
w.r.t is denoted by or and defined as
u u ( x x, y, z , t ) u ( x, y, z , t )
Lim
x x 0 x
Provided that above limit exists.
Similarly, partial derivative of w.r.t to can be defined,
u u ( x, y y, z , t ) u ( x, y, z , t )
Lim
y y 0 y
u u ( x, y, z z , t ) u ( x, y, z , t )
Lim
Example: z z 0 z
Suppose is a function of more than one variable such that,
u ( x, y, z ) x cos z x 2 y 2e z
u
cos z 2 x y 2e z
x
u
0 x 2 2 y e z 2 yx 2e z
y
u
x( sinz ) x 2 y 2e z
z
Partial Differential Equations:
A partial differential equation (PDE) is a relationship between an unknown function of several variables and
its partial derivatives. Let is unknown function and x and t are independent variables, then we
usually write, and we say that u is dependent variable.
Examples:
Heat Equation
Wave Equation
Laplace Equation
PDE involves two or more independent variables. In this example, and are independent variables.
Order of PDE:
The order of a PDE is the order of the highest derivative that occurs in the equation.
Page | 1
MTH646 Handout
Examples:
u u
1st order 1) 0, order order PDE
t x
2u u
2nd order 2)
x 2
(1 )1/2 ,
y
order order PDE
4th order 3)
4u 2u
u 0, order order PDE
x 4 t 2
Degree of a PDE:
A PDE is the degree of the highest order derivative which occurs in it after the equation has been
rationalized. Examples:
u 2u
1) c( 2 ), degee
t x
u
2
u
2) ( 2 )3 ( ) u 0, degee
x x
u 2 3u
Squaring, 3) 1 ( ) y 3 ,
x x
Squaring ,
u 2 3u
1 ( ) y 2 ( 3 )2 , degee
x x
Dimension of PDE:
The dimension of a PDE is the number of independent variables taken in space direction in the partial
differential equation. Examples:
u 2u
1) c 2 , dim or
t x
2u 2u
2) 0, dim or
x 2 y 2
2u 2u 2u
3) 0, dim or
x 2 y 2 z 2
Lecture No. 02
Homogeneous and non-homogeneous PDEs:
If all the terms of a PDE contain the dependent variable or its partial derivatives then such a PDE is called
homogeneous or non-homogeneous otherwise. Examples:
u 2u
1) ( x 2 y 2) 3u 0
t xy
2
2u 2u 2u u 2 u
2) ux u
2
xy uy ( ) ( ) u3 0
x 2 xy y 2 x y
2u 2u 2 2u
3) ( ) 2 x2 y 2
x 2 xy y
Eqs. (1) and (2) are homogeneous while Eq.(3) is non-homogeneous partial differential equations.
General Solutions of PDE:
A solution of a PDE is any function which satisfies the equation. A general solution of a PDE is a solution
which contains the number of arbitrary independent functions equal to the order of the equation.
Page | 2
MTH646 Handout
Example: The solution of the second order PDE
2u
2 x y is
xx
1
u x 2 y xy 2 F ( x) G ( y )
2
Here and are arbitrary independent functions, it is a general solution.
Particular Solution of PDE:
A particular solution is one which can be obtained from general solution by particular choice of arbitrary
function. Example:
In particular , F ( x) 2sin x, G ( x) 3 y 5, then we have
4
1
u x 2 y xy 2 F ( x) G ( x)
2
1
u x 2 y xy 2 2sin x 3 y 4 5
2
Which is particular solution of the PDE.
Auxiliary Conditions:
The PDEs that represent physical systems usually have infinite number of solutions. For example:
The functions u x 2 y 2 , u e x cos y , u log( x 2 y 2 ),
u sin x.sinh y,...
are entirely different from each other are solutions of PDE
2u 2u
0
x 2 y 2
To obtain a unique (i.e. single) solution of the PDE corresponding to a given physical problem, one must
use the additional information (i.e. auxiliary condition) arising from the physical situation. They fall in two
categories:
1) Boundary conditions
2) Initial conditions
Boundary Conditions:
These are the conditions that must be satisfied at the points on the boundary S of the region R in which the
partial differential equation hold. (or a condition that is required to be satisfied at all or part of the
boundary S of a region R in which a set of differential conditions is to be solved).These are three types of
boundary condition;
Dirichlet condition: u ( x, y ) g ( x, y ) on S
u ( x, y )
Neumann ( or flax) condition: g ( x, y ) on S
n
Where normal derivative i.e. a directional derivative taken in the direction normal to some surface.
Lecture No. 03
Finite Difference Method (FDM):
Finite difference method (FDM) is utmost common, efficient, frequent and universally applicable method
for the solution of various types of PDEs. The numerical solutions obtained from FDM are actually the
values of discrete points in the solution domain which we are called them grid points as shown in Figure 1.
Page | 4
MTH646 Handout
We usually prefer the space between the grid points in both and directions
should be uniform and grid spacing between the points in x-direction is denoted
by .
Likewise space between the grid points in y-direction is denoted by .
One can also be utilized the unequal (non-uniform) grid spacing in both coordinate
directions but the difference between successive pairs of grid points in each
direction should be the same.
If represents the coordinates of the grid point P in solution domain as shown in the Figure. Then the
grid point will show its position is immediately to the right of the grid point in positive x
direction and likewise the grid point will show its position is immediately to the left of the point
in negative x-direction. Similarly, the grid point will move immediately one step up in
positive y-direction and grid point will move immediately one step down in negative y-direction.
Finite difference approximation techniques are basically applied on as an alternative source of the
derivatives to find out the approximate solution by converting the desire research problem in the form of
PDEs into the easily solvable algebraic difference equations.
Taylor Series Expansion Applied to Finite Difference Method:
The partial derivatives in PDEs are replaced by the finite difference approximations at each grid point
which are approximated by then neighboring values utilizing the Taylor’s series expansion. The general
interpretation of Taylor’s series expansion says that if we know the value of a function and its derivatives
at some particular point, say then we can easily find the value s of function at its nearby points
( xi hx , y j , tk ) and ( xi hx , y j , tk ).
By Taylor’s series expansions about the point , the exact expression for
f ( xi hx , y j , tk ) and f ( xi hx , y j , t k ).
Is given as
And
In particular, if is very small, then and its higher power can be neglected.
Rewrite the above two questions as;
And
The above two equations are second order accurate. If terms of order and higher order terms are
neglected, than the above terms reduced to the following expressions;
And
The above two equations are first order accurate. The truncation error is the amount of quantity by which
the solution of a PDE fails to satisfy the approximate solution at some grid point. The truncation error can
be reduced by retaining more terms in the Taylor’s series expansion.
Page | 5
MTH646 Handout
Lecture No. 04
Solving for
f ( xi hx , y j , tk ) f ( xi hx , y j , tk )
f x ( xi , y j , tk ) O(hx ) 2
2(hx )
The above expression is the second order central difference approximation. In order to obtain a finite
difference for the second order partial derivative add Eqs 1 and 2, we get
Solving for
f ( xi hx , y j , tk ) 2 f ( xi , y j , tk ) f ( xi hx , y j , tk )
f xx ( xi , y j , tk ) 2
O(hx ) 2
(hx )
The above equation is second order central difference form for the derivative at some point
Finite difference approximations for the y-derivatives are obtained in exactly the similar way as
the results are analogous to the expressions for the x-derivatives.
f ( xi , y j hy , tk ) f ( xi , y j , tk )
f y ( xi , y j , tk ) O ( hy ) Forward Difference
hy
f ( xi , y j , tk ) f ( xi , y j hy , tk )
f y ( xi , y j , tk ) O ( hy ) Backward Difference
hy
f ( xi , y j hy , tk ) f ( xi , y j hy , tk )
f y ( xi , y j , tk ) O ( hy ) 2 Central Difference of first derivative
2( hy )
f ( xi , y j hy , tk ) 2 f ( xi , y j , tk ) f ( xi , y j hy , t k )
f yy ( xi , y j , tk ) 2
O (hy ) 2 Central Difference of second order
( hy )
The second order central difference can also be obtained by utilizing the both forward and backward
differences as follows:
Therefore
By using this technique we can also generate a formula for difference approximation for the mixed partial
derivatives at some point . To find difference approximation for , first
we apply x-derivative as central difference and after that y-derivative as central difference as follows
Page | 6
MTH646 Handout
Therefore
To determine such type of finite difference approximation for the mixed partial derivatives are highly
effective in solving the many types of PDEs in which mixed partial derivatives are involved. The other
difference approximations for higher order derivative as well as for mixed partial order derivatives can also
be derived by utilizing the same procedure.
Lecture No. 05
Stability of FDM:
The stability of finite difference is connected to the deterioration or growth of the error with the passage
of time throughout any phase of computing. The schemes will be stable if the computing error does not
rise with time.
To find the out the approximation solution of the research problem that governing the PDEs to the exact
analytical solution it is necessary that our computational domain should be discretized to a finite number
of grid points ( ), where and are the constant gird spacing in and directions and is the
time spacing between the time levels.
Suppose that is the approximate solution of the finite difference applied to PDE and exact analytical
solution of PDE is donated by , and then is defined by the following relation
| |
The choice of is very important while we are studying the stability of the finite difference method. The
finite difference scheme applied to PDE can produce acceptable results that grow boundedly for the choice
of small as compared to the results that grow unboundedly. If too large is selected, in this case,
scheme is said to be unstable.
A finite difference scheme is said to be stable if error do not grown unboundedly with the passage of time
on each time level
| | | |,
The two most commonly used techniques for analyzing the stability of the method are the matrix and the
Fourier Stability analysis.
Matrix Stability Analysis:
The matrix stability analysis applied to finite difference scheme on each grid point of the computational
domain will result of the following two time levels system of linear equation
Where
[ ] And [ ]
Are the solution vectors at and time level respectively while and are the
matrices of known values. If is the error vector of eq. 1 then it must satisfy the equation, therefore
Or | | | || |
Therefore, the finite difference scheme described in eq. 1 is stable if | | . The condition described
in eq. 2 is sufficient condition for a finite difference scheme to be stable.
Fourier (Von Neumann) Stability Analysis:
This model is applicable to the linear finite difference PDEs and when spatial domain is periodic. To test
whether finite difference scheme is stable, then it is sufficient to look its round-off errors or simple say
Page | 7
MTH646 Handout
‘error’ that should not amplified in the calculation with time. This is the numerical error introduced for a
repetitive number of calculations in which the computer is constantly rounding the number to some
decimal points. Round-off error is actually the difference between the numerical solutions from a
real computer with finite accuracy, we donate it by and for exact solution of the finite-difference
equation we donate it by .
ik, j x, y Uik, j x, y uik, j x, y … (3)
The eq. 3 satisfy the finite difference approximation equation and round-off error can be expressed in the
Fourier series expansion as
∑ ∑
∫ ∫
And √ and is the interval of the function. Suppose that the solution error has the following form,
k 1 l1 , l2
Define: G l1 , l2
k l1 , l2
Where is the amplification factor and is the Fourier component. The finite difference
scheme will be stable if every Fourier component is stable.
The Von Neumann stability is given by
G l1 , l2 1 … (4)
If the finite difference scheme satisfied the condition defined in eq. 4 then amplification factor will
not grow as we march forward in time . It has been observed that more and more time steps are
required for calculation over a given interval of time. When we utilize explicit finite difference scheme in
which we are forced to choose that should be less than to a specific limit imposed by stability
constrains. Whereas in case of implicit and Crank-Nicolson finite difference schemes, fewer time steps
are required for our calculation over a given interval of time in which we are free to choose even larger
values of time steps .
Lecture No. 06
Consistency and Convergence of FDM:
If the magnitude of truncation error approaches zero as the grid sizes and in both directions of
coordinate axis along with approaches zero, then the approximate solution of the PDE is said to be
consistent with the exact numerical solution. In other words, truncation error vanishes as we utilize small
mesh sizes and time steps that tend to zero i.e. , and .
Note that consistency is a necessary condition but not a sufficient condition for convergence. A finite
difference scheme is said to be convergent if approximate solution, of PDE approaches to zero, as grid
sizes and as well as approaches zero.
| |
The stability and consistency of linear PDEs with constant coefficients implies convergence.
Explicit, Implicit and Crank-Nicolson Schemes:
A finite difference scheme is said to be fully explicit scheme if we can find the value of the function at the
next time level on each grid points of the computational domain with the help of an explicit formula which
contains gird point values in the previous time level. The fully explicit scheme leads us to impose the
restriction on choosing the maximum acceptable time steps for stability. So to attain the stability of the
finite difference scheme, we have to utilize so many time steps if we are going to choose such that it
approaches to zero.
Page | 8
MTH646 Handout
On the other hand, in fully implicit schemes there are no such explicit formula exists to find the values at
the grid points directly from the previous time level because the values on each the grid points are
scattered between two time levels on both sides of the difference equation. The resultant finite difference
equation generates system of linear algebraic equation that can be solved by utilizing matrices. In fully
implicit schemes, there is no restriction on choosing the maximum acceptable time steps for stability
such as fully explicit scheme. Therefore, fewer number of time steps can be utilized with a large time steps
for stability.
Mathematically, to understand the concept of fully explicit and implicit schemes, we need to consider the
following 2D head conduction PDE at some grid point ( ), of the solution domain.
u( xi , y j , tk ) 2u( xi , y j , tk ) 2u( xi , y j , tk ) uik, j 2uik, j 2uik, j
Or 2 … (1)
t x 2 y 2 t x y 2
Where is the thermal diffusivity and dependent variable ( ) is a temperature function of space
( ) and time Replace the space derivatives by the second order central difference at time level
and time derivative by first order forward difference in eq. and writing the expression ( ) as ,
we obtain the following expression
uik, j 1 uik, j u k 2uik, j uik1, j uik, j 1 2uik, j uik, j 1
i 1, j … (2)
t (x)2 (y)2
The eq. 2 contains only unknown dependent variable at time that can explicitly be solved
from the unknown values of , , , and at time . This is a typical example of fully
explicit infinite difference method. Now replace the space derivatives by the second order central
difference at time level and time derivative by the first order forward difference in equation.
We obtain form equation 1:
2uik, j 1 2uik, j 1
uik, j 1
… (3)
t x
2
y 2
Similarly form equation 2:
uik, j 1 uik, j uik1,1 j 2uik, j 1 uik1,1 j uik, j 11 2uik, j 1 uik, j 11
… (4)
t (x)2 (y)2
The schemes defined in eq. 4s is called fully implicit scheme. In contrast to the fully explicit scheme, the
temperature variable cannot be solved purely in terms of function values at time step . By replacing
the space derivative on the right side of the eq. 1 by average between two times levels and , we
meet with the following expression of the form
… (5)
The eq. 5 the unknown dependent temperature variable at time level cannot explicitly be
evaluated or expressed in term of the known values at time level . The unknown quantity can also
be not solvable for some particular grid point ( ). Therefore eq. 5 can only be solved over all the
grid points of the computational domain which will be the result of system of large simultaneous linear
equations that can be solved with the help of matrices.
The expression in eq. 5 is typically example of implicit scheme and this is known as implicit Crank-Nicolson
scheme. In the above section, we’ll briefly summaries the advantages and disadvantages of fully explicit,
implicit and Crank-Nicolson finite difference schemes.
Page | 9
MTH646 Handout
Lecture No. 07
Crank-Nicolson Scheme:
In Crank-Nicolson Scheme we need to solve the coupled linear system at and time level
separately on both side of the equation.
Since Crank-Nicolson Scheme combines the fully implicit and explicit schemes. Therefore, spatial and
time derivative are both countered around .
There is no limitation of choosing the maximum size of time step to attain the stability like full implicit
scheme.
Crank-Nicolson Scheme has unconditionality stability and second order accuracy in both time and space.
Iterative Methods:
To solve the system of linear equations which are in the form of sparse matrices, the iterative methods are
very efficient. In all types of iterative methods we first need the initial guess to start the iterative process
and this process continuously repeated until satisfactory converged solutions are achieved by applying a
certain predefined convergence criteria. The system of linear equations can be represented by the
following equation
…… (1)
Where is a non-singular co-efficient matrix and refers to the known column vector and is the
column vector that to be determined. The co-efficient matrix in equation 1 can be partitioned as follows,
Where matrix is refer to the diagonal matrix, are lower and upper triangular elements of
matrix respectively.
Iterative Methods:
Some well-known methods to solve iterative problems are;
1. Jacobi’s Method
2. Gauss-Seidel Method
3. Relaxation Method
i) SOR (Successive Over Relaxation Method) ii) SUR (Successive Under Relaxation Method)
Page | 10
MTH646 Handout
Jacobi’s Method: Consider
That is
Relaxation Method:
Consider recurrence relation
( ) …… (2)
Here is defined in the equation 2 as the acceleration parameter which is used to accelerate convergence
rate. When is chosen, we come across with Jacobi iterative method and when is selected,
Gauss-Seidel iterative method is obtained. The value of acceleration parameter lies between 0 and 2, if
we want to select value of (say) i.e. the values between 0 and 1, then the method will between
Jacobi and Gauss-Seidel. We could even select the value of , resulting that we are using a method
beyond the Gauss-Seidel method (known as SOR – Successive Over Relaxation Method).
Convergence of Iterative Method:
If we apply the standard form of the iterative scheme, we have the following expression,
…… (1)
Here represents the number of iterations. Suppose that iterative scheme described in equation 1 has the
exact solution , then we have the following equation,
…… (2)
Subtract eq. 2 from eq. 1 we have
….. (3)
Page | 11
MTH646 Handout
Or equivalently
…… (4)
Where , is defined to donate the error on the iteration w.r.to the exact solution. For
convergence, we need to check the magnitude of the error vector (can be measured by some vector
norm) that approaches to zero as the number of iteration increases to infinity (i.e. ‖ ‖
which in turn implies that ). Apply the vector norm on both sides of the equation 4,
‖ ‖ ‖ ‖
Apply the compatibility inequality we obtained,
‖ ‖ ‖ ‖‖ ‖
The iterative scheme will converge if the iteration matrix satisfies the following property,
‖ ‖ …… (5)
If the inequality described in equation 5 holds, then
‖ ‖
‖ ‖ ‖ ‖ Or ‖ ‖
Lecture No. 08
Some Useful Approximations to a Derivative:
The following are the useful approximations to a derivative that should be kept in mind for the solutions of
various types of PDEs.
1. Forward Difference
2. Backward Difference
6. Backward Difference
Solution: Use the forward difference approximation for and central difference approximation for on
given equation
( )
Page | 12
MTH646 Handout
( )
( )( )
{
And
Lecture No. 09
Example: 2
Find the numerical solution of following heat equation by forward difference method (Explicit Method) by
taking ;
Page | 13
MTH646 Handout
Since
Use the forward difference approximation for and central difference approximation for on given
equation
( )
( )
( )( )
{
And
Similarly
For in equation 1, we have
Page | 14
MTH646 Handout
For in equation 1, we have
Similarly
Since, the calculated value of and the calculated value from exact solution is ,
so the error can be calculated as;
| | | |
Similarly
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
(Do Your Self; Take values from above calculations.)
(Understand carefully, first we take j = 0, then calculate exact solution and error. Now we’ll perform the
same calculations with next step values i.e. j = 1, then calculate exact solution and error; and Done.)
…… (1)
(This equation given above, here typed again just for help.)
Now, for in equation 1, we have
Page | 15
MTH646 Handout
Similarly
For in equation 1, we have
Similarly
Page | 16
MTH646 Handout
Lecture No. 10
Example: 3
Find the numerical solution of following heat equation
𝜕𝑢 𝜕2 𝑢
= 𝛼 2 2 𝑜𝑟 𝑢𝑡 = 𝛼 2 𝑢𝑥𝑥
𝜕𝑡 𝜕𝑥
By forward difference method at 𝑇 = 0.005, = 0.1 𝑎𝑛𝑑 𝑘 = 0.001
𝑢 0, 𝑡 = 0
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛;
𝑢 1, 𝑡 = 0
1
2𝑥 , 0≤𝑥≤
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = 2
1
2 1−𝑥 , <𝑥≤1
2
Solution: It is given that
= 0.1 , 𝑘 = 0.001 𝑎𝑛𝑑 𝑇 = 0.005
Since
𝑏−𝑎 1−0
𝑛= = = 10 𝑖 = 1,2,3 … 𝑛 − 1
0.1
Also
𝑇 − 𝑡0 0.005 − 0
𝑚= = =5 𝑗 = 0,1,2,3 … 𝑚 − 1
𝑘 0.001
Therefore
𝑛 = 10, 𝑠𝑜 𝑖 = 1,2, … ,9
𝑚 = 5, 𝑠𝑜 𝑗 = 0,1,2,3,4
Apply forward difference (FDW) on time-derivative and central difference (CD) on space derivative of the
given equation and choose 𝛼 = 1, we get
⍵𝑖,𝑗 +1 = 𝜆⍵𝑖−1,𝑗 + 1 − 2𝜆 ⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗 … (1)
Where
𝑘 0.001
𝜆= 2= = 0.1
(0.1)2
Therefore 1 − 2𝜆 = 1 − 2 0.1 = 0.8
By putting value of 𝜆 , equation 1 becomes
⍵𝑖,𝑗 +1 = 0.1 ⍵𝑖−1,𝑗 + 0.8 ⍵𝑖,𝑗 + 0.1 ⍵𝑖+1,𝑗 … (2)
First we’ll calculate values for ⍵ using initial conditions as follows,
1
(𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛: 𝑢 𝑥, 0 = 2𝑥 𝑖𝑓 0 ≤ 𝑥 ≤ ∴ = 0.1)
2
⍵1,0 = ⍵ 𝑥1 , 𝑡0 = ⍵ 0.1 , 0 = 2𝑥1 = 2 × 0.1 = 0.2
⍵2,0 = ⍵ 𝑥2 , 𝑡0 = ⍵ 0.2 , 0 = 2𝑥2 = 2 × 0.2 = 0.4
⍵3,0 = ⍵ 𝑥3 , 𝑡0 = ⍵ 0.3 , 0 = 2𝑥3 = 2 × 0.3 = 0.6
⍵4,0 = ⍵ 𝑥4 , 𝑡0 = ⍵ 0.4 , 0 = 2𝑥4 = 2 × 0.4 = 0.8
⍵5,0 = ⍵ 𝑥5 , 𝑡0 = ⍵ 0.5 , 0 = 2𝑥5 = 2 × 0.5 = 1.0
1
(𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛: 𝑢 𝑥, 0 = 2 1 − 𝑥 𝑖𝑓 < 𝑥 ≤ 1 ∴ = 0.1)
2
⍵6,0 = ⍵ 𝑥6 , 𝑡0 = ⍵ 0.6 , 0 = 2(1 − 𝑥6 ) = 2(1 − 0.6) = 0.8
⍵7,0 = ⍵ 𝑥7 , 𝑡0 = ⍵ 0.7 , 0 = 2(1 − 𝑥7 ) = 2(1 − 0.7) = 0.6
⍵8,0 = ⍵ 𝑥8 , 𝑡0 = ⍵ 0.8 , 0 = 2(1 − 𝑥8 ) = 2(1 − 0.8) = 0.4
⍵9,0 = ⍵ 𝑥9 , 𝑡0 = ⍵ 0.9 , 0 = 2(1 − 𝑥9 ) = 2(1 − 0.9) = 0.2
⍵10,0 = ⍵ 𝑥10 , 𝑡0 = ⍵ 1.0 , 0 = 2(1 − 𝑥10 ) = 2(1 − 1) = 0.0
𝐹𝑖𝑥 𝑗 = 0
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2,3,4,5,6,7,8,9 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 2
Page | 17
MTH646 Handout
⍵𝑖,𝑗 +1 = 0.1 ⍵𝑖−1,𝑗 + 0.8 ⍵𝑖,𝑗 + 0.1 ⍵𝑖+1,𝑗 … (2)
𝑖 = 1; ⍵1,1 = 0.1 ⍵0,0 + 0.8 ⍵1,0 + 0.1 ⍵2,0 = 0.1(0.0) + 0.8 0.2 + 0.1 0.4 = 0.20
𝑖 = 2; ⍵2,1 = 0.1 ⍵1,0 + 0.8 ⍵2,0 + 0.1 ⍵3,0 = 0.1(0.2) + 0.8 0.4 + 0.1 0.6 = 0.40
𝑖 = 3; ⍵3,1 = 0.1 ⍵2,0 + 0.8 ⍵3,0 + 0.1 ⍵4,0 = 0.1(0.4) + 0.8 0.6 + 0.1 0.8 = 0.60
𝑖 = 4; ⍵4,1 = 0.1 ⍵3,0 + 0.8 ⍵4,0 + 0.1 ⍵5,0 = 0.1(0.6) + 0.8 0.8 + 0.1 1.0 = 0.80
𝑖 = 5; ⍵5,1 = 0.1 ⍵4,0 + 0.8 ⍵5,0 + 0.1 ⍵6,0 = 0.1(0.8) + 0.8 1.0 + 0.1 0.8 = 0.96
𝑖 = 6; ⍵6,1 = 0.1 ⍵5,0 + 0.8 ⍵6,0 + 0.1 ⍵7,0 = 0.1(1.0) + 0.8 0.8 + 0.1 0.6 = 0.80
𝑖 = 7; ⍵7,1 = 0.1 ⍵6,0 + 0.8 ⍵7,0 + 0.1 ⍵8,0 = 0.1(0.8) + 0.8 0.6 + 0.1 0.4 = 0.60
𝑖 = 8; ⍵8,1 = 0.1 ⍵7,0 + 0.8 ⍵8,0 + 0.1 ⍵9,0 = 0.1(0.6) + 0.8 0.4 + 0.1 0.2 = 0.40
𝑖 = 9; ⍵9,1 = 0.1 ⍵8,0 + 0.8 ⍵9,0 + 0.1 ⍵10,0 = 0.1(0.4) + 0.8 0.2 + 0.1 0.0 = 0.20
In the same way you can find the values of next time levels fixing j=1 and put x=1, 2, 3...9.
Also find the other values for fixing 𝑗 = 2, 𝑗 = 3 𝑎𝑛𝑑 𝑗 = 4.
Example: 4
Find the numerical solution of following heat equation
𝜕𝑢 2
𝜕2 𝑢
=𝛼 , 0<𝑥<2 , 𝑡>0
𝜕𝑡 𝜕𝑥 2
By forward difference method at 𝑇 = 0.01 𝑎𝑛𝑑 𝑛 = 2 , 𝑚 = 2
𝑢 0, 𝑡 = 0
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛;
𝑢 2, 𝑡 = 0
𝜋
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = sin 𝑥
2
Solution: Since
𝑏−𝑎 2−0
= = =1
𝑛 2
𝑇 − 𝑡0 0.1 − 0
𝑘= = = 0.05
𝑚 2
As 𝑛 = 2 , 𝑚 = 2 , 𝑖 = 1 , 𝑗 = 0,1
⍵𝑖,𝑗 +1 = 𝜆⍵𝑖−1,𝑗 + 1 − 2𝜆 ⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗 … (1)
Where
𝛼 2 𝑘 1(0.05)
𝜆= 2 = = 0.05
(1)2
By putting value of 𝜆 , equation 1 becomes
⍵𝑖,𝑗 +1 = 0.05 ⍵𝑖−1,𝑗 + 0.9 ⍵𝑖,𝑗 + 0.05 ⍵𝑖+1,𝑗 … (2)
𝐹𝑖𝑥 𝑗 = 0
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 2
⍵1,1 = 0.05 ⍵0,0 + 0.9 ⍵1,0 + 0.05 ⍵2,0 = 0.05(0) + 0.9 0.1 + 0.05 0 = 0.9
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 2
⍵1,2 = 0.05 ⍵0,1 + 0.9 ⍵1,1 + 0.05 ⍵2,1 = 0.05(0) + 0.9 0.9 + 0.05 0 = 0.81
Lecture No. 11
Example: 5
Find the numerical solution of following heat equation
𝜕𝑢 𝜕2 𝑢
= 𝛼2 2 , 0≤𝑥≤2 , 𝑡>0
𝜕𝑡 𝜕𝑥
By forward difference method at 𝑇 = 0.05, = 0.1 𝑎𝑛𝑑 𝑘 = 0.01
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(2, 𝑡) = 0 ∀𝑡
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; {𝑢 𝑥, 0 = 𝑠𝑖𝑛(2𝜋𝑥) 0≤𝑥≤2
Page | 18
MTH646 Handout
Exact solution is given as
2𝑡
𝑢 𝑥, 𝑡 = 𝑒 −4𝜋 𝑠𝑖𝑛(2𝜋𝑥)
Solution: It is given that
= 0.1 , 𝑘 = 0.01 𝑎𝑛𝑑 𝑇 = 0.05
Since
𝑏−𝑎 2−0
𝑛= = = 20
0.1
Also
𝑇 − 𝑡0 0.05 − 0
𝑚= = = 50
𝑘 0.01
Therefore
𝑖 = 1,2, … ,19 & 𝑗 = 0,1,2, … ,49
𝜕𝑢 𝜕2𝑢 𝑘
Apply forward difference (FDW) on and central difference (CD) on and 𝜆 = . We get the
𝜕𝑡 𝜕𝑥 2 2
following equation (𝐵𝑦 𝑟𝑒𝑝𝑙𝑎𝑐𝑖𝑛𝑔 "𝜔" 𝑏𝑦 "𝑢")
⍵𝑖,𝑗 +1 = 𝜆⍵𝑖−1,𝑗 + 1 − 2𝜆 ⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗 … (𝐴)
Now calculate
𝑘 0.01
𝜆= 2= =1
(0.1)2
So equation (A) becomes,
⍵𝑖,𝑗 +1 = ⍵𝑖−1,𝑗 − ⍵𝑖,𝑗 + ⍵𝑖+1,𝑗 … (𝐵)
Given conditions in "⍵" form can be written as
⍵0,𝑗 = 0 ∀ 𝑗 = 0,1,2, … ,49
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛𝑠;
⍵20,𝑗 = 0 ∀ 𝑗 = 0,1,2, … ,49
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; ⍵𝑖,0 = 𝑠𝑖𝑛(2𝜋𝑥) ∀ 𝑖 = 0,1,2, … ,19
𝐹𝑖𝑥 𝑗 = 0
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2, … ,19 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (𝐵)
⍵𝑖,𝑗 +1 = ⍵𝑖−1,𝑗 − ⍵𝑖,𝑗 + ⍵𝑖+1,𝑗 … (𝐵)
𝑖 = 1; ⍵1,1 = ⍵0,0 − ⍵1,0 + ⍵2,0 = 𝑠𝑖𝑛 2𝜋 × 0.0 − 𝑠𝑖𝑛 2𝜋 × 0.1 + 𝑠𝑖𝑛 2𝜋 × 0.2 = 0.3633
𝑖 = 2; ⍵2,1 = ⍵1,0 − ⍵2,0 + ⍵3,0 = 𝑠𝑖𝑛 2𝜋 × 0.1 − 𝑠𝑖𝑛 2𝜋 × 0.2 + 𝑠𝑖𝑛 2𝜋 × 0.3 = 0.5878
Similarly
𝑖 = 3; ⍵3,1 = ⍵2,0 − ⍵3,0 + ⍵4,0 = 0.5878
𝑖 = 4; ⍵4,1 = ⍵3,0 − ⍵4,0 + ⍵5,0 = 0.3633
𝑖 = 5; ⍵5,1 = ⍵4,0 − ⍵5,0 + ⍵6,0 = 0.0
𝑖 = 6; ⍵6,1 = ⍵5,0 − ⍵6,0 + ⍵7,0 = −0.3633
𝑖 = 7; ⍵7,1 = ⍵6,0 − ⍵7,0 + ⍵8,0 = −0.5878
Similarly
𝑖 = 8; ⍵8,1 = −0.5878 𝑖 = 9; ⍵9,1 = −0.3633
𝑖 = 10; ⍵10,1 = 0.0 𝑖 = 11; ⍵11,1 = 0.3633
𝑖 = 12; ⍵12,1 = 0.5878 𝑖 = 13; ⍵13,1 = 0.5878
𝑖 = 14; ⍵14,1 = 0.3633 𝑖 = 15; ⍵15,1 = 0.0
𝑖 = 16; ⍵16,1 = −0.3633 𝑖 = 17; ⍵17,1 = −0.5878
𝑖 = 18; ⍵18,1 = −0.5878 𝑖 = 19; ⍵19,1 = −0.3633
Now
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2, … ,19 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (𝐵)
Similarly; perform calculations till fixing 𝑗 = 49 and Find Exact Solution.
Lengthy calculations; so you can skip the above part. Watch Lecture.
Page | 19
MTH646 Handout
Lecture No. 12
Example: 6
Find the numerical solution of following heat equation
𝜕𝑢(𝑥, 𝑡) 2
𝜕 2 𝑢(𝑥, 𝑡)
−𝛼 =0 , 0≤𝑥≤2 , 𝑡>0
𝜕𝑡 𝜕𝑥 2
By forward difference method at 𝑇 = 0.5, = 0.1 𝑎𝑛𝑑 𝑘 = 0.05
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(2, 𝑡) = 0 ∀𝑡
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 {𝑢 𝑥, 0 = 𝑠𝑖𝑛(2𝜋𝑥) 0≤𝑥≤2
Exact solution is given as
2𝑡
𝑢 𝑥, 𝑡 = 𝑒 −4𝜋 𝑠𝑖𝑛(2𝜋𝑥)
Solution: It is given that
= 0.1 , 𝑘 = 0.05 𝑎𝑛𝑑 𝑇 = 0.5
Since
𝑏−𝑎 2−0
𝑛= = = 20
0.1
Also
𝑇 − 𝑡0 0.5 − 0
𝑚= = = 10
𝑘 0.05
Therefore
𝑖 = 1,2, … ,19 & 𝑗 = 0,1,2, … ,9
Given conditions in "⍵" form can be written as
⍵0,𝑗 = 0 ∀ 𝑗 = 0,1,2, … ,9
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛𝑠;
⍵20,𝑗 = 0 ∀ 𝑗 = 0,1,2, … ,9
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; ⍵𝑖,0 = 𝑠𝑖𝑛(2𝜋𝑥) ∀ 𝑖 = 0,1,2, … ,19
Since
𝛼 2 𝑘 (1)2 (0.05)
𝜆= 2 = =5
(0.1)2
𝜕𝑢 𝜕2𝑢
Apply forward difference (FDW) on and central difference (CD) on . We get the following
𝜕𝑡 𝜕𝑥 2
equation(𝐵𝑦 𝑟𝑒𝑝𝑙𝑎𝑐𝑖𝑛𝑔 "𝜔" 𝑏𝑦 "𝑢")
⍵𝑖,𝑗 +1 = 𝜆⍵𝑖−1,𝑗 + 1 − 2𝜆 ⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗 … (𝐴)
By Putting 𝜆 = 5 value equation (A) becomes,
⍵𝑖,𝑗 +1 = 5 ⍵𝑖−1,𝑗 − 9 ⍵𝑖,𝑗 + 5 ⍵𝑖+1,𝑗 … (1)
𝐹𝑖𝑥 𝑗 = 0
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2, … ,19 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (1)
⍵𝑖,𝑗 +1 = 5 ⍵𝑖−1,𝑗 − 9 ⍵𝑖,𝑗 + 5 ⍵𝑖+1,𝑗 … (1)
𝑖 = 1; ⍵1,1 = 5⍵0,0 − 9⍵1,0 + 5⍵2,0 = 5𝑠𝑖𝑛 2𝜋 × 0.0 − 9𝑠𝑖𝑛 2𝜋 × 0.1 + 5𝑠𝑖𝑛 2𝜋 × 0.2 = −0.5348
𝑖 = 2; ⍵2,1 = 5⍵1,0 − 9⍵2,0 + 5⍵3,0 = 5𝑠𝑖𝑛 2𝜋 × 0.1 − 9𝑠𝑖𝑛 2𝜋 × 0.2 + 5𝑠𝑖𝑛 2𝜋 × 0.3 = −0.8653
Similarly
𝑖 = 3; ⍵3,1 = 5⍵2,0 − 9⍵3,0 + 5⍵4,0 = −0.8653
𝑖 = 4; ⍵4,1 = 5⍵3,0 − 9⍵4,0 + 5⍵5,0 = −0.5348
𝑖 = 5; ⍵5,1 = 5⍵4,0 − 9⍵5,0 + 5⍵6,0 = 0.0
𝑖 = 6; ⍵6,1 = 5⍵5,0 − 9⍵6,0 + 5⍵7,0 = 0.5348
𝑖 = 7; ⍵7,1 = 5⍵6,0 − 9⍵7,0 + 5⍵8,0 = 0.8653
𝑖 = 8; ⍵8,1 = 5⍵7,0 − 9⍵8,0 + 5⍵9,0 = 0.8653
𝑖 = 9; ⍵9,1 = 5⍵8,0 − 9⍵9,0 + 5⍵10,0 = 0.5348
𝑖 = 10; ⍵10,1 = 5⍵9,0 − 9⍵10,0 + 5⍵11,0 = 0.0
Page | 20
MTH646 Handout
Similarly
𝑖 = 11; ⍵11,1 = −0.5348 𝑖 = 12; ⍵12,1 = −0.8653
𝑖 = 13; ⍵13,1 = −0.8653 𝑖 = 14; ⍵14,1 = −0.5348
𝑖 = 15; ⍵15,1 = 0.0 𝑖 = 16; ⍵16,1 = 0.5348
𝑖 = 17; ⍵17,1 = 0.8653 𝑖 = 18; ⍵18,1 = 0.8653
𝑖 = 19; ⍵19,1 = 0.5348 𝑖 = 20; ⍵20,1 = _______?
Now
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2, … ,19 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (1)
Similarly; perform calculations till fixing 𝑗 = 9.
Lengthy calculations; so you can skip the above part.
𝐸𝑥𝑎𝑐𝑡 𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛:
2
𝑢 𝑥, 𝑡 = 𝑒 −4𝜋 𝑡 𝑠𝑖𝑛2𝜋𝑥
𝜔1,1 = 𝜔 𝑥1 , 𝑡1 = 𝜔 0.1 , 0.05 = ________ 𝜔2,1 = 𝜔 𝑥2 , 𝑡1 = 𝜔 0.2 , 0.05 = ________
𝜔3,1 = 𝜔 𝑥3 , 𝑡1 = 𝜔 0.3 , 0.05 = ________ 𝜔4,1 = 𝜔 𝑥4 , 𝑡1 = 𝜔 0.4 , 0.05 = ________
𝜔5,1 = 𝜔 𝑥5 , 𝑡1 = 𝜔 0.5 , 0.05 = ________ 𝜔6,1 = 𝜔 𝑥6 , 𝑡1 = 𝜔 0.6 , 0.05 = ________
𝜔7,1 = 𝜔 𝑥7 , 𝑡1 = 𝜔 0.7 , 0.05 = ________ 𝜔8,1 = 𝜔 𝑥8 , 𝑡1 = 𝜔 0.8 , 0.05 = ________
𝜔9,1 = 𝜔 𝑥9 , 𝑡1 = 𝜔 0.9 , 0.05 = ________ 𝜔10,1 = 𝜔 𝑥10 , 𝑡1 = 𝜔 1.0 , 0.05 = ________
𝜔11,1 = 𝜔 𝑥11 , 𝑡1 = 𝜔 1.1 , 0.05 = ________ 𝜔12,1 = 𝜔 𝑥12 , 𝑡1 = 𝜔 1.2 , 0.05 = ________
𝜔13,1 = 𝜔 𝑥13 , 𝑡1 = 𝜔 1.3 , 0.05 = ________ 𝜔14,1 = 𝜔 𝑥14 , 𝑡1 = 𝜔 1.4 , 0.05 = ________
𝜔15,1 = 𝜔 𝑥15 , 𝑡1 = 𝜔 1.5 , 0.05 = ________ 𝜔16,1 = 𝜔 𝑥16 , 𝑡1 = 𝜔 1.6 , 0.05 = ________
𝜔17,1 = 𝜔 𝑥17 , 𝑡1 = 𝜔 1.7, 0.05 = ________ 𝜔18,1 = 𝜔 𝑥18 , 𝑡1 = 𝜔 1.8 , 0.05 = ________
𝜔19,1 = 𝜔 𝑥19 , 𝑡1 = 𝜔 1.9 , 0.05 = ________ 𝜔20,1 = 𝜔 𝑥20 , 𝑡1 = 𝜔 2.0 , 0.05 = ________
Example: 7
Find the numerical solution of following heat equation
𝜕𝑢(𝑥, 𝑡) 𝜕 2 𝑢(𝑥, 𝑡)
− 𝛼2 =0 , 0≤𝑥≤1 , 𝑡>0
𝜕𝑡 𝜕𝑥 2
By forward difference method at 𝑇 = 0.1, 𝑛 = 3 𝑎𝑛𝑑 𝑚 = 2
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡 > 0
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 {𝑢 𝑥, 0 = 2𝑠𝑖𝑛(2𝜋𝑥) 0≤𝑥≤1
Exact solution is given as
𝜋2
− 𝑡
𝑢 𝑥, 𝑡 = 2𝑒 4 𝑠𝑖𝑛(2𝜋𝑥)
Solution: It is given that
𝑇 = 0.1 , 𝑛 = 3 𝑎𝑛𝑑 𝑚 = 2
Since
𝑏−𝑎 1−0
= = = 0.33
𝑛 3
Also
𝑇 − 𝑡0 0.1 − 0
𝑘= = = 0.05
𝑚 2
Since
𝑛 = 3 𝑠𝑜 𝑖 = 1,2 & 𝑚 = 2 𝑠𝑜 𝑗 = 1
𝜕𝑢 𝜕2𝑢 𝑘
Apply forward difference (FDW) on and central difference (CD) on and 𝜆 = . We get the
𝜕𝑡 𝜕𝑥 2 2
following equation (𝐵𝑦 𝑟𝑒𝑝𝑙𝑎𝑐𝑖𝑛𝑔 "𝜔" 𝑏𝑦 "𝑢")
⍵𝑖,𝑗 +1 = 𝜆⍵𝑖−1,𝑗 + 1 − 2𝜆 ⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗 … (1)
Where
𝛼 2 𝑘 (0.25)2 (0.05)
𝜆= 2 = = 0.029
(0.33)2
Page | 21
MTH646 Handout
So, equation (1) becomes,
⍵𝑖,𝑗 +1 = 0.029 ⍵𝑖−1,𝑗 + 0.942 ⍵𝑖,𝑗 + 0.029 ⍵𝑖+1,𝑗 … (2)
𝐹𝑖𝑥 𝑗 = 0
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (2)
𝑖 = 1; ⍵1,1 = 0.029 ⍵0,0 + 0.029 ⍵1,0 + 0.029 ⍵2,0 = 1.6001
𝑖 = 2; ⍵2,1 = 0.029 ⍵1,0 + 0.029⍵2,0 + 0.029 ⍵3,0 = 1.6001
Now
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (2)
𝑖 = 1; ⍵1, = 0.029 ⍵0,1 + 0.029 ⍵1,1 + 0.029 ⍵2,1 = _________
𝑖 = 2; ⍵2,2 = 0.029 ⍵1,1 + 0.029⍵2,1 + 0.029 ⍵3,1 = _________
Do Your Self. Also find the Exact Solution.
Lecture No. 13
Example: 8
Find the numerical solution of following heat equation
𝜕𝑢(𝑥, 𝑡) 2
𝜕 2 𝑢(𝑥, 𝑡)
=𝛼 , 0≤𝑥≤1 , 𝑡>0
𝜕𝑡 𝜕𝑥 2
By backward difference method (implicit scheme) at 𝑇 = 1, = 0.25 𝑎𝑛𝑑 𝑘 = 0.0625
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 {𝑢 𝑥, 0 = 𝑠𝑖𝑛𝜋𝑥 0≤𝑥≤1
Solution: It is given that
𝑇 = 1 , = 0.25 𝑎𝑛𝑑 𝑘 = 0.0625
Since
𝑏−𝑎 1−0
𝑛= = =4
0.25
Also
𝑇 − 𝑡0 1−0
𝑘= = = 16
𝑚 0.0625
Since
𝑖 = 1,2,3 & 𝑗 = 1,2, … ,15
𝜕𝑢 𝜕2𝑢
Apply backward difference/implicit scheme (IS) on and central difference (CD) on . We get the
𝜕𝑡 𝜕𝑥 2
following equation (𝐵𝑦 𝑟𝑒𝑝𝑙𝑎𝑐𝑖𝑛𝑔 "𝜔" 𝑏𝑦 "𝑢")
𝛼2𝑘
⍵𝑖,𝑗 − ⍵𝑖,𝑗 −1 = 2 ⍵𝑖−1,𝑗 − 2 ⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗
Where
𝛼2𝑘
=𝜆
2
By solving above equation, we have
⍵𝑖,𝑗 −1 = −𝜆⍵𝑖−1,𝑗 + 1 + 2𝜆 ⍵𝑖,𝑗 − 𝜆⍵𝑖+1,𝑗 … (1)
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2,3 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (1)
𝑖 = 1; ⍵1,0 = −𝜆⍵0,1 + 1 + 2𝜆 ⍵1,1 − 𝜆 ⍵2,1
𝑖 = 2; ⍵2,0 = −𝜆 ⍵1,1 + 1 + 2𝜆 ⍵2,1 − 𝜆 ⍵3,1 … (𝐴)
𝑖 = 3; ⍵3,0 = −𝜆 ⍵2,1 + 1 + 2𝜆 ⍵3,1 − 𝜆 ⍵4,1
Since given conditions in "⍵" form can be written as
𝑢 0, 𝑡 = 0 => ⍵0,𝑗 = 0
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛𝑠;
𝑢 1, 𝑡 = 0 => ⍵4,𝑗 = 0
Page | 22
MTH646 Handout
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥
⍵𝑖,𝑜 = 𝑠𝑖𝑛𝜋𝑥𝑖 ∀ 𝑖 = 1,2,3
By Solving, we have
⍵1,0 = 𝑠𝑖𝑛 0.25𝜋 = 0.707
⍵2,0 = 𝑠𝑖𝑛 0.50𝜋 = 1.0
⍵3,0 = 𝑠𝑖𝑛 0.75𝜋 = 0.707
Now, from equation (A) in matrix form
1 + 2𝜆 −𝜆 0 ⍵1,1 ⍵1,0
−𝜆 1 + 2𝜆 −𝜆 ⍵ 2,1 = ⍵2,0 … (𝐵)
0 −𝜆 1 + 2𝜆 ⍵ 3,1 ⍵3,0
Since
𝛼 2 𝑘 (1)2 (0.0625)
𝜆= 2 = =1
(0.25)2
By Putting 𝜆 = 1 value equation (B) becomes
3 −1 0 ⍵1,1 0.707
−1 3 −1 ⍵2,1 = 1
0 −1 3 ⍵3,1 0.707
As we know matrix relation,
𝐴𝜔 = 𝑏 => 𝜔 = 𝐴−1 𝑏
By calculating, we get
⍵1,1 0.4458
⍵2,1 = 0.6305
⍵3,1 0.4458
Now
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2,3 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (1)
Similarly; perform calculations till fixing 𝑗 = 15.
Lengthy calculations; so you can skip the above part.
Lecture No. 14
Example: 9
Find the numerical solution of following heat equation
𝜕𝑢 𝜕2 𝑢
= 𝛼2 2 , 0≤𝑥≤1 , 𝑡>0
𝜕𝑡 𝜕𝑥
By backward difference method (implicit scheme) at 𝑇 = 1, = 0.2 𝑎𝑛𝑑 𝑘 = 0.04
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 {𝑢 𝑥, 0 = 𝑠𝑖𝑛𝜋𝑥 0≤𝑥≤1
Solution: It is given that
𝑇 = 1 , = 0.2 , 𝑘 = 0.04 , 𝑎 = 0 𝑎𝑛𝑑 𝑏 = 1
Since
𝑏−𝑎 1−0
𝑛= = =5
0.2
Also
𝑇 − 𝑡0 1−0
𝑚= = = 25
𝑘 0.04
Since
𝑖 = 1,2,3,4 & 𝑗 = 1,2, … ,24
𝜕𝑢 𝜕2𝑢
Apply backward difference/implicit scheme (IS) on and central difference (CD) on . We get the
𝜕𝑡 𝜕𝑥 2
following equation (𝐵𝑦 𝑟𝑒𝑝𝑙𝑎𝑐𝑖𝑛𝑔 "𝜔" 𝑏𝑦 "𝑢")
Page | 23
MTH646 Handout
⍵𝑖,𝑗 −1 = −𝜆⍵𝑖−1,𝑗 + 1 + 2𝜆 ⍵𝑖,𝑗 − 𝜆⍵𝑖+1,𝑗 … (1)
Where
𝛼2𝑘
=𝜆
2
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2,3,4 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (1)
𝑖 = 1; ⍵1,0 = −𝜆⍵0,1 + 1 + 2𝜆 ⍵1,1 − 𝜆 ⍵2,1
𝑖 = 2; ⍵2,0 = −𝜆 ⍵1,1 + 1 + 2𝜆 ⍵2,1 − 𝜆 ⍵3,1
… (𝐴)
𝑖 = 3; ⍵3,0 = −𝜆 ⍵2,1 + 1 + 2𝜆 ⍵3,1 − 𝜆 ⍵4,1
𝑖 = 4; ⍵4,0 = −𝜆 ⍵3,1 + 1 + 2𝜆 ⍵4,1 − 𝜆 ⍵5,1
Since given conditions in "⍵" form can be written as
𝑢 0, 𝑡 = ⍵0,𝑗 = 0 ∀ 𝑗 = 1,2, … ,24
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛𝑠;
𝑢 1, 𝑡 = ⍵4,𝑗 = 0 ∀ 𝑗 = 1,2, … ,24
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢(𝑥, 0) = 𝑠𝑖𝑛𝜋𝑥 ∀ 𝑖 = 1,2,3,4
By solving, we have
𝜔1,0 = 𝜔 𝑥1 , 𝑡0 = 𝜔 0.2 , 0 = 𝑠𝑖𝑛 0.2𝜋 = 0.5877
𝜔2,0 = 𝜔 𝑥2 , 𝑡0 = 𝜔 0.4 , 0 = 𝑠𝑖𝑛 0.4𝜋 = 0.9510
𝜔3,0 = 𝜔 𝑥3 , 𝑡0 = 𝜔 0.6 , 0 = 𝑠𝑖𝑛 0.6𝜋 = 0.9510
𝜔4,0 = 𝜔 𝑥4 , 𝑡0 = 𝜔 0.8 , 0 = 𝑠𝑖𝑛 0.8𝜋 = 0.5877
Equation (A) becomes (in Matrix form),
1 + 2𝜆 −𝜆 0 0 ⍵1,1 0.5877
−𝜆 1 + 2𝜆 −𝜆 0 ⍵2,1 0.9540
0 −𝜆 1 + 2𝜆 −𝜆 ⍵3,1 = 0.9510 … (𝐵)
0 0 −𝜆 1 + 2𝜆 ⍵4,1 0.5877
Since
𝛼 2 𝑘 (1)2 (0.04)
𝜆= 2 = =1
(0.2)2
By Putting 𝜆 = 1 value equation (B) becomes
3 −1 0 0 ⍵1,1 0.5877
−1 3 −1 0 ⍵
= 0.9540 … (𝐶)
2,1
0 −1 3 −1 ⍵3,1 0.9510
0 0 −1 3 ⍵ 4,1 0.5877
𝐴 𝜔=𝑏
−1
To find 𝜔 values, first we find inverse of 𝐴 𝑖. 𝑒. 𝐴
3 −1 0 0 1 0 0 0
−1 3 −1 0 ~ 0 1 0 0
0 −1 3 −1 0 0 1 0
0 0 −1 3 0 0 0 1
Now apply Row Operations given below
1) 𝑅1 ↔ 𝑅2 & − 1𝑅1
2) −3𝑅1 + 𝑅2
3) 𝑅2 ↔ 𝑅3 & − 1𝑅2
4) 3𝑅2 + 𝑅1 & − 8𝑅2 + 𝑅3
5) 𝑅3 ↔ 𝑅4
6) 8𝑅3 + 𝑅1 , 3𝑅3 + 𝑅2 & − 21𝑅3 + 𝑅4
1
7) 𝑅4
55
8) 3𝑅4 + 𝑅3 , 9𝑅4 + 𝑅2 & 21𝑅4 + 𝑅1
Hence our required value for
Page | 24
MTH646 Handout
21 8 3 −1
55 55 55 55
9 27 17 −24
55 55 55 55
𝐴−1 =
3 9 24 −8
55 55 55 55
1 3 8 −21
55 55 55 55
So equation (C) becomes,
⍵1,1 21 8 3 −1 0.5877
⍵2,1 1 9 27 17 −24 0.9540
⍵3,1 = 55 3 9 24 −8 0.9510
⍵4,1 1 3 8 −21 0.5877
Hence we get
⍵1,1 = 0.40395 ⍵2,1 = 0.60054
⍵3,1 = 0.51720 ⍵4,1 = −0.02352
Required result.
Lecture No. 15
Example: 10
Find the numerical solution of following heat equation
𝜕𝑢 𝜕 2 𝑢
= … 1𝐷
𝜕𝑡 𝜕𝑥 2
By backward difference method (implicit scheme) at = 0.25 𝑎𝑛𝑑 𝑘 = 0.005
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡
1
2𝑥 , 0≤𝑥≤ , 𝑡=0
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = 2
1
2 1−𝑥 , <𝑥≤1 , 𝑡=0
2
Solution:
We can write the given equation as,
𝑘
⍵𝑖,𝑗 − ⍵𝑖,𝑗 −1 = 2 ⍵𝑖−1,𝑗 − 2⍵𝑖,𝑗 + ⍵𝑖+1,𝑗 … (1)
Let
𝑘
= 𝜆 = 0.08
2
So, we can write equation (1) as, (without putting 𝜆 value)
⍵𝑖,𝑗 − ⍵𝑖,𝑗 −1 = 𝜆⍵𝑖−1,𝑗 − 2𝜆⍵𝑖,𝑗 + 𝜆⍵𝑖+1,𝑗
Or by solving we have
⍵𝑖,𝑗 −1 = −𝜆⍵𝑖−1,𝑗 + 1 + 2𝜆 ⍵𝑖,𝑗 − 𝜆⍵𝑖+1,𝑗
By putting 𝜆 value, it becomes
⍵𝑖,𝑗 −1 = −0.08 ⍵𝑖−1,𝑗 + 1.16 ⍵𝑖,𝑗 − 0.08 ⍵𝑖+1,𝑗 … (2)
Since
𝑏−𝑎 1−0
𝑛= = =4 𝑖 = 1,2,3
0.25
Also
𝑇 − 𝑡0 1−0
𝑚= = = 200 𝑗 = 0,1,2, … ,199
𝑘 0.005
Since given conditions in "⍵" form can be written as
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; ⍵0,𝑗 = ⍵4,𝑗 = 0
Page | 25
MTH646 Handout
⍵𝑖,0 = 2𝑥𝑖 , 𝑖 = 1,2
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛;
⍵𝑖,0 = 2 1 − 𝑥𝑖 , 𝑖 = 3,4
𝐹𝑖𝑥 𝑗 = 1
𝐴𝑛𝑑 𝑝𝑢𝑡 𝑖 = 1,2,3 𝑖𝑛 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 (2)
𝑖 = 1; ⍵1,0 = −0.08 ⍵0,1 + 1.16 ⍵1,1 − 0.08 ⍵2,1 = 0.5
𝑖 = 2; ⍵2,0 = −0.08 ⍵1,1 + 1.16 ⍵2,1 − 0.08 ⍵3,1 = 1.0 … (𝐴)
𝑖 = 3; ⍵3,0 = −0.08 ⍵2,1 + 1.16 ⍵3,1 − 0.08 ⍵4,1 = 0.5
Equation (A) becomes (in Matrix form),
1.16 −0.08 0 ⍵1,1 0.5
−0.08 1.16 −0.08 ⍵ 2,1 = 1.0 … (𝐵)
0 −0.08 1.16 ⍵ 3,1 0.5
𝐴 𝜔=𝑏
−1
To find 𝜔 values, first we find inverse of 𝐴 𝑖. 𝑒. 𝐴
Note: You can find 𝐴−1 value by applying row operation, as we did in previous example. So,
0.8662 0.0600 0.0041
𝐴−1 = 0.0600 0.8703 0.0600
0.0041 0.0600 0.8620
So equation (B) becomes,
𝜔 = 𝐴−1 𝑏
⍵1,1 0.8662 0.0600 0.0041 0.5
⍵2,1 = 0.0600 0.8703 0.0600 1.0
⍵3,1 0.0041 0.0600 0.8620 0.5
Hence we get
⍵1,1 = 0.49517 ⍵2,1 = 0.93032 ⍵3,1 = 0.49307
Required result.
Lecture No. 16
Exercise:
Question#1: Find the numerical solution of following heat equation
𝜕𝑢(𝑥, 𝑡) 𝜕 2 𝑢(𝑥, 𝑡)
= , 0 ≤ 𝑥 ≤ 1 ,𝑡 > 0
𝜕𝑡 𝜕𝑥 2
By backward difference method (implicit scheme) at 𝑇 = 1, = 0.1 𝑎𝑛𝑑 𝑘 = 0.005
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡
1
2𝑥 , 0≤𝑥≤ , 𝑡=0
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = 2
1
2 1−𝑥 , <𝑥≤1 , 𝑡=0
2
Hint:
𝑛 = 10 , 𝑖 = 1,2, … ,9
𝑚 = 200 , 𝑗 = 1,2, … ,99
Question#2: Find the numerical solution of following heat equation
𝜕𝑢 2
𝜕2 𝑢
=𝛼 , 0 ≤ 𝑥 ≤ 1 ,𝑡 > 0
𝜕𝑡 𝜕𝑥 2
By backward difference method (implicit scheme) at 𝑇 = 1, = 0.1 𝑎𝑛𝑑 𝑘 = 0.01
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡 >0
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = 𝑠𝑖𝑛𝜋𝑥 0≤𝑥≤1
Hint:
𝑛 = 10 , 𝑖 = 1,2, … ,9
𝑚 = 200 , 𝑗 = 1,2, … ,99
𝐴 →9×9 , 𝐴−1 =? , 𝐴⍵ = 𝑏 , ⍵ =?
Page | 26
MTH646 Handout
Question#3: Find the numerical solution of following heat equation
𝜕𝑢 4 𝜕2 𝑢
= , 0 ≤ 𝑥 ≤ 4,𝑡 > 0
𝜕𝑡 𝜋 2 𝜕𝑥 2
By both forward and backward difference methods at 𝑇 = 0.08, = 0.2 𝑎𝑛𝑑 𝑘 = 0.04
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(4, 𝑡) = 0 ∀𝑡
𝜋𝑥 𝜋𝑥
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = 𝑠𝑖𝑛 1 + 2𝑐𝑜𝑠 , 0≤𝑥≤4
4 4
Exact Solution:
𝜋𝑥 −𝑡 𝜋
𝑢 𝑥, 𝑡 = 𝑒 −𝑡 𝑠𝑖𝑛 + 𝑒 4 𝑠𝑖𝑛
2 4
Question#4: Find the numerical solution of following heat equation
𝜕𝑢 1 𝜕2 𝑢
= , 0 ≤ 𝑥 ≤ 1,𝑡 > 0
𝜕𝑡 𝜋 2 𝜕𝑥 2
By both explicit and implicit methods at 𝑇 = 0.08, = 0.1 𝑎𝑛𝑑 𝑘 = 0.04
𝐵𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 0, 𝑡 = 𝑢(1, 𝑡) = 0 ∀𝑡 >0
1
𝐼𝑛𝑖𝑡𝑖𝑎𝑙 𝐶𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛; 𝑢 𝑥, 0 = 𝑐𝑜𝑠𝜋 𝑥 − , 0≤𝑥≤1
2
Exact Solution:
1
𝑢 𝑥, 𝑡 = 𝑒 −𝑡 𝑐𝑜𝑠𝜋 𝑥 −
2
Lecture No. 17
Page | 27
MTH646 Handout
𝑎11 𝑎12 0 0 𝑙11 𝑙11 𝑢12 0 0
𝑎21 𝑎22 𝑎23 0 𝑙 𝑙21 𝑢12 + 𝑙22 𝑙22 𝑢23 0
𝑎33 𝑎34 = 21 𝑙33 𝑢34
0 𝑎32 0 𝑙32 𝑙32 𝑢23 + 𝑙33
0 0 𝑎43 𝑎44 0 0 𝑙43 𝑙43 𝑢34 + 𝑙44
By comparing, we have
𝑎 12
𝑙11 = 𝑎11 𝑙11 𝑢12 = 𝑎12 ⇒ 𝑢12 =
𝑙 11
𝑙21 = 𝑎21 𝑙21 𝑢12 + 𝑙22 = 𝑎22 ⇒ 𝑙22 = 𝑎22 − 𝑙21 𝑢12
𝑎
𝑙32 = 𝑎32 𝑙22 𝑢23 = 𝑎23 ⇒ 𝑢23 = 23
𝑙 22
𝑙43 = 𝑎43 𝑙32 𝑢23 + 𝑙33 = 𝑎33 ⇒ 𝑙33 = 𝑎33 − 𝑙32 𝑢23
𝑎
𝑙33 𝑢34 = 𝑎34 ⇒ 𝑢34 = 34 𝑙43 𝑢34 + 𝑙44 = 𝑎44 ⇒ 𝑙44 = 𝑎44 − 𝑙43 𝑢34
𝑙 33
In general, we can write
𝑎 12
𝑆𝑡𝑒𝑝 − 𝐼: Set 𝑙11 = 𝑎11 , 𝑢12 =
𝑙 11
𝑆𝑡𝑒𝑝 − 𝐼𝐼: For 𝑖 = 1,2, … 𝑛 − 1
𝑙𝑖,𝑖−1 = 𝑎𝑖,𝑖−1
𝑙𝑖𝑖 = 𝑎𝑖𝑖 + 𝑙𝑖,𝑖−1 . 𝑢𝑖−1,𝑖 ; 𝑖 = 2, … , 𝑛 − 1
𝑎𝑖,𝑖+1
𝑢𝑖,𝑖+1 = ; 𝑖 = 2, … , 𝑛 − 1
𝑙𝑖𝑖
𝑆𝑡𝑒𝑝 − 𝐼𝐼𝐼: 𝑙𝑛,𝑛−1 = 𝑎𝑛,𝑛−1
𝑙𝑛,𝑛 = 𝑎𝑛 ,𝑛 − 𝑙𝑛 ,𝑛−1 . 𝑢𝑛−1,𝑛
As 𝐿𝑦 = 𝑏
𝑙11 0 0 0 𝑦1 𝑏1
𝑙21 𝑙22 0 0 𝑦2 𝑏2
𝑦3 =
0 𝑙32 𝑙33 0 𝑏3
0 0 𝑙43 𝑙44 𝑦4 𝑏4
So,
𝑏1 1
𝑦1 = , 𝑦2 = 𝑏 − 𝑙21 𝑦1
𝑙11 𝑙22 2
1 1
𝑦3 = 𝑏 − 𝑙32 𝑦2 , 𝑦4 = 𝑏 − 𝑙43 𝑦3
𝑙33 3 𝑙44 4
𝑏1
𝑆𝑡𝑒𝑝 − 𝐼𝑉: Set 𝑦1 =
𝑙 11
𝑆𝑡𝑒𝑝 − 𝑉: For 𝑖 = 1,2, … 𝑛
1
𝑦𝑖 = 𝑏 − 𝑙𝑖,𝑖−1 . 𝑦𝑖−1
𝑙𝑖𝑖 𝑖
Since 𝑈𝑥 = 𝑦
1 𝑢12 0 0 𝑥1 𝑦1
0 1 𝑢23 0 𝑥2 𝑦2
=
0 0 1 𝑢34 𝑥3 𝑦3
0 0 0 1 𝑥4 𝑦4
So,
𝑥1 + 𝑢12 𝑥2 = 𝑦1 𝑥1 = 𝑦1 − 𝑢12 𝑥2
𝑥2 + 𝑢23 𝑥3 = 𝑦2 𝑥2 = 𝑦2 − 𝑢23 𝑥3
𝑥3 + 𝑢34 𝑥4 = 𝑦3 𝑇𝑖𝑠 𝑖𝑚𝑝𝑙𝑖𝑒𝑠 ⇒ 𝑥3 = 𝑦3 − 𝑢34 𝑥4
𝑥4 = 𝑦4 𝑥4 = 𝑦4
𝑆𝑡𝑒𝑝 − 𝑉𝐼: Set 𝑥𝑛 = 𝑦𝑛
𝑆𝑡𝑒𝑝 − 𝑉𝐼𝐼: For 𝑖 = 1,2, … 𝑛 − 1
𝑥𝑖 = 𝑦𝑖 − 𝑢𝑖,𝑖+1 . 𝑥𝑖+1
These are the seven steps to solve the Crout’s Method.
Page | 28
MTH646 Handout
Lecture No. 18
Example: 11
Solve the following system of linear equations by Crout’s method.
𝑎1 𝑥1 + 𝑐1 𝑥2 = 𝛼1
𝑏2 𝑥1 + 𝑎2 𝑥2 + 𝑐2 𝑥3 = 𝛼2
𝑏3 𝑥2 + 𝑎3 𝑥3 + 𝑐3 𝑥4 = 𝛼3
𝑏4 𝑥3 + 𝑎4 𝑥4 = 𝛼4
Solution: In matrix form, we can write it as
𝑎1 𝑐1 0 0 𝑥1 𝛼1
𝑏2 𝑎2 𝑐 2 0 𝑥 2 𝛼
𝑎 𝑐 𝑥 = 𝛼2 … (1)
0 𝑏3 3 3 3 3
0 0 𝑏4 𝑎4 𝑥 4 𝛼 4
So, 𝐴𝑥 =𝑏
Matrix A can be decompose as 𝐿 𝑈 = 𝐴 … (2)
Where
𝑙1 0 0 0 1 𝑢1 0 0
𝑏2 𝑙2 0 0 0
𝐿= , 𝑈= 0 1 𝑢2
0 𝑏3 𝑙3 0 0 0 1 𝑢3
0 0 𝑏4 𝑙4 0 0 0 1
So equation (2) can written as
𝐿𝑈=𝐴
𝑙1 0 0 0 1 𝑢1 0 0 𝑎1 𝑐1 0 0
𝑏2 𝑙2 0 0 0 1 𝑢2 0 𝑏 𝑎2 𝑐2 0
= 2
0 𝑏3 𝑙3 0 0 0 1 𝑢3 0 𝑏3 𝑎3 𝑐3
0 0 𝑏4 𝑙4 0 0 0 1 0 0 𝑏4 𝑎4
𝑙1 𝑙1 𝑢1 0 0 𝑎1 𝑐1 0 0
𝑏2 𝑏2 𝑢1 + 𝑙2 𝑙2 𝑢2 0 𝑏 𝑎2 𝑐2 0
= 2
0 𝑏3 𝑏2 𝑢2 + 𝑙3 𝑙3 𝑢3 0 𝑏3 𝑎3 𝑐3
0 0 𝑏4 𝑏4 𝑢3 + 𝑙4 0 0 𝑏4 𝑎4
So,
𝑐 𝑐
𝑙1 = 𝑎1 , 𝑢1 = 1 𝑙 , 𝑢2 = 2 𝑙 , 𝑙2 = 𝑎2 − 𝑏2 𝑢1
1 2
𝑐3
𝑢3 = 𝑙3 , 𝑙3 = 𝑎3 − 𝑏3 𝑢2 , 𝑙4 = 𝑎4 − 𝑏4 𝑢3
𝑐1
𝑆𝑡𝑒𝑝 − 𝐼: Set 𝑙1 = 𝑎1 , 𝑢1 = 𝑙1
𝑆𝑡𝑒𝑝 − 𝐼𝐼: For 𝑖 = 1,2, … 𝑛 − 1
𝑐𝑖
𝑙𝑖 = 𝑎𝑖 − 𝑏𝑖 . 𝑢𝑖−1 , 𝑢𝑖 = 𝑙𝑖
𝑆𝑡𝑒𝑝 − 𝐼𝐼𝐼: 𝑙𝑛 = 𝑎𝑛 − 𝑏𝑛 . 𝑢𝑛−1
So, U becomes,
𝑐1
1 𝑙1 0 0
0
𝑐2 𝑐3
𝑈= 0 1 𝑙2 𝑙3
0 0 1
0 0 0 1
Now as, 𝐿 𝑦 = 𝑏 so,
𝑙1 0 0 0 𝑦1 𝛼1
𝑏2 𝑙2 0 0 𝑦2 𝛼2
0 𝑏3 𝑙3 0 𝑦3 = 𝛼3
0 0 𝑏4 𝑙4 𝑦4 𝛼4
Page | 29
MTH646 Handout
So,
𝑑1
𝑦1 =
𝑙1
1
𝑦2 = 𝑑 − 𝑏2 𝑦1
𝑙2 2
1
𝑦3 = 𝑑 − 𝑏3 𝑦2
𝑙3 3
1
𝑦4 = 𝑑 − 𝑏4 𝑦3
𝑙4 4
𝑑1
𝑆𝑡𝑒𝑝 − 𝐼𝑉: Set 𝑦1 =
𝑙1
𝑆𝑡𝑒𝑝 − 𝑉: For 𝑖 = 1,2, … 𝑛
1
𝑦𝑖 = 𝑑 − 𝑏𝑖 . 𝑦𝑖−1
𝑙𝑖 𝑖
Now, 𝑈 𝑥 = 𝑦
1 𝑢1 0 0 𝑥1 𝑦1
0 1 𝑢2 0 𝑥2 𝑦2
0 0 1 𝑢3 𝑥3 = 𝑦3
0 0 0 1 𝑥4 𝑦4
So,
𝑥1 = 𝑦1 − 𝑢1 𝑥2
𝑥2 = 𝑦2 − 𝑢2 𝑥3
𝑥3 = 𝑦3 − 𝑢3 𝑥4
𝑥4 = 𝑦4
𝑆𝑡𝑒𝑝 − 𝑉𝐼: Set 𝑥𝑛 = 𝑦𝑛
𝑆𝑡𝑒𝑝 − 𝑉: For 𝑖 = 1,2, … 𝑛 − 1
𝑥𝑖 = 𝑦𝑖 − 𝑢𝑖 . 𝑥𝑖+1
As,
𝑐1
𝑐1 𝑥1 = 𝑦1 − 𝑙1 𝑥2
1 𝑙1 0 0
0 𝑐2
𝑐2 𝑥2 = 𝑦2 − 𝑙2 𝑥3
𝑈= 0 1 𝑐3 𝑆𝑜, 𝑏𝑦 𝑝𝑢𝑡𝑡𝑖𝑛𝑔 𝑣𝑎𝑙𝑢𝑒𝑠
𝑙2 𝑙3
𝑐3
0 0 1 𝑥3 = 𝑦3 − 𝑙3 𝑥4
0 0 0 1
𝑥4 = 𝑦4
____________________________________________
“Good Luck For The Mid-Term Exam”
Page | 31