Unit V

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

1

Unit V Boundary Value Problems in Ordinary and Partial Differential Equations


Prepared by Dr. K.A. Selvakumaran
Unit V Boundary Value Problems in Ordinary and Partial
Differential Equations


Finite difference solution of second order ordinary differential equation Finite difference
solution of one dimensional heat equation by explicit and implicit methods One
dimensional wave equation and two dimensional Laplace and Poisson equations.


Difference Quotient:

A difference quotient is the quotient obtained by dividing the difference between two values of a
function by the difference between the corresponding values of the independent variable. For example,
( ) ( )
( )
y x h y x
x h x
+
+
is a difference quotient.

We know that
0
( ) ( )
lim
h
dy y x h y x
dx h

+
= . If h is small, we approximate
( ) ( ) dy y x h y x
dx h
+
.

In the case of partial derivatives, the derivatives are approximated as follows:

( , ) ( , )
( , ) ( , )
x
y
u x h y u x y
u
h
u x y k u x y
u
k
+
=

`
+

=

)
Forward difference approximation

( , ) ( , )
( , ) ( , )
x
y
u x y u x h y
u
h
u x y u x y k
u
k

=

`


=

)
Backward difference approximation

2
2
( , ) 2 ( , ) ( , )
( , ) 2 ( , ) ( , )
xx
yy
u x h y u x y u x h y
u
h
u x y k u x y u x y k
u
k
+ +
=
+ +
=


Geometrical Representation

Divide the xy plane into series of rectangles whose sides are parallel to x & y axes such that
and x h y k A = A = . The points of intersection of these straight lines are known as mesh points or grid
points or lattice points. Denote the mesh points by subscripts as shown in the figure.

2


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran




(i, j+1)


(i-1, j) (i, j) (i+1, j)


(i, j-1)


Then
1, ,
, 1 ,
i j i j
x
i j i j
y
u u
u
h
u u
u
k
+
+

=


=

)
Forward difference approximation

, 1,
, , 1
i j i j
x
i j i j
y
u u
u
h
u u
u
k


=

)
Backward difference approximation

1, , 1,
2
2
i j i j i j
xx
u u u
u
h
+
+
= ;
, 1 , , 1
2
2
i j i j i j
yy
u u u
u
k
+
+
=

We can also write,
1, 1,
2
i j i j
x
u u
u
h
+

= ;
, 1 , 1
2
i j i j
y
u u
u
k
+

=


Solution Second Order Ordinary Differential Equation by Finite Difference Method

Suppose the given differential equation is '' ' y Ay By C + + = with the boundary conditions
0
( ) , ( )
n
y x a y x b = = , where A, B and C are functions of x.

In this method we replace the derivatives ' and '' y y by their finite difference approximations
given below.
1 1 1 1
2
2
'( ) and ''( )
2
i i i i i
y y y y y
y x y x
h h
+ +
+
= = , 1, 2, , 1 i n =

Then the given differential equation is reduced to a system of linear algebraic equations. By
solving this system of equations we get the desired y value.
3


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
Exercise: 1

1. Using finite difference method, solve for y given the differential equation
2
2
1 0, (0, 1)
d y
y x
dx
+ + = e and the boundary conditions (0) (1) 0 y y = = , taking
1
2
h = .
Ans: 0.1429
2. Using finite difference method, solve
2
2
d y
y
dx
= in (0, 2) given (0) 0, (2) 3.63 y y = = , subdividing
the range of x into 4 equal parts.
Ans: 0.5268, 1.1853, 2.1401
3. Using finite difference method, solve '' 64 10 0, (0, 1) y y x + = e given (0) (1) 0 y y = = ,
subdividing the interval into 4 equal parts.
Ans: 0.1287, 0.1471, 0.1287
4. Using finite differences solve
1
'' 0 given (1) 1, (2) 2,
4
xy y y y h + = = = = .
Ans: 1.3513, 1.635, 1.8505
Problems for Practice:
5. Solve '' 0 y xy = given (0) 1, (1) 2 y y = = by finite difference method taking 2. n =
Ans: 0.4706
6. Solve '' , (0, 1) y y x x = e given (0) (1) 0 y y = = , using finite differences dividing the interval into
4 equal parts.
Ans: 0.03488, 0.05632, 0.05002
7. Using finite differences solve '' ' 2 0 given (0) 2, (1) 2.85 y y y y y + = = = .
Ans: (0.5) 0.5565 y =


Classification of Partial Differential Equations of the Second Order

The general form of linear partial differential equation of second order is

2 2 2
2 2
0
u u u u u
A B C D E Fu
x x y y x y
c c c c c
+ + + + + =
c c c c c c
, where A, B, C, D, E and F are functions of x & y.

The above equation is said to be
i) elliptic if
2
4 0 B AC <
ii) parabolic if
2
4 0 B AC =
iii) hyperbolic if
2
4 0 B AC > .

Examples:
1. Elliptic: i)
2 2
2 2
0
u u
x y
c c
+ =
c c
Laplace equation
ii)
2 2
2 2
( , )
u u
f x y
x y
c c
+ =
c c
Poisson equation
4


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
2. Parabolic:
2
2 2
1 u u
x t o
c c
=
c c
One dimensional heat equation

3. Hyperbolic:
2 2
2 2 2
1 u u
x t o
c c
=
c c
One dimensional wave equation


Exercise: 2

Classify the following partial differential equations.

1. 3 4 3 0
xx xy yy y
u u u u + + = .
2.
2 2 2
( ) 0, ,
xx yy
x u a y u x a y a + = < < < < .
3. 6 9 17 0
xx xy yy y
u u u u + = .
4.
2 2
(1 ) 0
xx yy
x f y f + = .
5.
2 2
4 ( 4 ) sin( )
xx xy yy
u u x y u x y + + + = + .
6. ( 1) 2( 2) ( 3) 0
xx xy yy
x u x u x u + + + + = .
7. 0, 0, 0
xx yy
x f y f x y + = > > .



Solution of One Dimensional Heat Equation


The one dimensional heat equation
2
2 2
1 u u
x t o
c c
=
c c
,
2
k
c
o

= is a parabolic equation. There are two


methods to solve 1 D heat equation.

1. Bender-Schmidt Method
Consider the equation
2
2
u u
a
x t
c c
=
c c
,
2
1
a
o
=
Replacing the derivatives by the difference quotients and simplifying we get,

, 1 1, , 1, 2
(1 2 ) , where
i j i j i j i j
k
u u u u
ah

+ +
= + + =

The above equation is called Explicit Formula and it is valid if
1
0
2
< s .
5


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
If
1
2
= , the above formula reduces to

where
2
2
1
2 2
k ah
k
ah
= = .

Scheme:


x

y



Note: The above formula can be used only when
2
2
ah
k = . Therefore, to use 2
nd
formula we select k
such that
2
2
ah
k = . If
2
2
ah
k = , we use the explicit formula.


Exercise: 3

1. Solve
2
2
u u
x t
c c
=
c c
given (0, ) 0, (4, ) 0, ( , 0) (4 ) u t u t u x x x = = = assuming 1 h k = = . Find the
values of u up to 5 t = .

2. Solve
2
2
1
2
u u
t x
c c
=
c c
with the conditions (0, ) 0, (4, ) 0, ( , 0) (4 ) u t u t u x x x = = = taking 1 h = and
employing Bender-Schmidt recurrence equation, continue the solution through five time steps.

3. Solve
t xx
u u = subject to (0, ) 0, (1, ) 0 and ( , 0) sin , 0 1 u t u t u x x x t = = = < < .

4. Given
2
2 2
2
, (0, ) (5, ) 0 and ( , 0) (25 )
f f
f t f t f x x x
x t
c c
= = = =
c c
, find f in the given range,
taking 1 h = and up to 5 seconds.

5. Solve 32
xx t
u u = , taking 0.25 h = for 0, 0 1 and ( , 0) 0, (0, ) 0, (1, ) t x u x u t u t t > < < = = = .

6. Find the values of ( , ) u x t satisfying the parabolic equation
2
2
4
u u
t x
c c
=
c c
and the boundary
conditions
2
(0, ) 0 (8, ) and ( , 0) 4
2
x
u t u t u x x = = = at the points , 0, 1, 2, , 7 x i i = = and
1
, 0, 1, 2, 3, 4, 5
8
t j j = = .
, 1 1, 1,
1
2
i j i j i j
u u u
+ +
( = +




(i-1, j) (i, j) (i+1, j)


(i, j+1)

6


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
2. Crank-Nicholson Difference Method

To solve: The one dimensional heat equation
2
2
u u
a
x t
c c
=
c c
,
2
1
a
o
= .

Using difference quotient approximations for ,
xx t
u u and simplifying we get,

1, 1 1, 1 , 1 1, 1, ,
1 1 1 1
( 1) ( 1)
2 2 2 2
i j i j i j i j i j i j
u u u u u u
+ + + + +
+ + = + +

where
2
k
ah
= . The above equation is called Crank-Nicholson difference scheme. It is also known
as Implicit Formula, as it does not give the value of u at (j+1)
th
step directly in terms of the
values of u at the j
th
step.

When 1 = , i.e.,
2
k ah = the above implicit formula takes the following simplest form

, 1 1, 1 1, 1 1, 1,
1
4
i j i j i j i j i j
u u u u u
+ + + + +
( = + + +



Scheme:


x

y





Exercise: 4

1. Using Crank-Nicholsons scheme, solve 16 , 0 1, 0
xx t
u u x t = < < > given ( , 0) 0, (0, ) 0, u x u t = =
(1, ) 100 u t t = . Compute u for one step in t direction taking
1
4
h = .

2. Solve by Crank-Nicholson method the equation
xx t
u u = subject to ( , 0) 0, (0, ) 0 u x u t = = and
(1, ) u t t = , for two time steps.
3. Using Crank-Nicholsons method, solve
2
2
,
u u
t x
c c
=
c c
subject to ( , 0) 0, (0, ) 0, u x u t = = and
(1, ) u t t = , taking 1/ 4 and 1/ 8 h k = = .

(i-1, j)
(i, j) (i+1, j)


(i, j+1)

(i-1, j+1)

(i+1, j+1)
7


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
4. Solve the equation
2
2
u u
t x
c c
=
c c
subject to the conditions
( , 0) sin , 0 1; (0, ) (1, ) 0 u x x x u t u t t = s s = = using Crank-Nicholson method, taking
1 1
,
3 36
h k = = (Do one time step).


Solution of One Dimensional Wave Equation


The one dimensional wave equation
2 2
2
2 2
u u
a
t x
c c
=
c c
is a hyperbolic equation. Replacing the
derivatives by the difference quotients and simplifying we get,

2 2 2 2
, 1 , 1, 1, , 1
2(1 ) ( ) , where
i j i j i j i j i j
k
u a u a u u u
h

+ +
= + + =

The above equation is called Explicit Formula to solve the wave equation.

When
2
2
1
a
= , i.e.,
h
k
a
= the above explicit formula takes the following simplest form

, 1 1, 1, , 1 i j i j i j i j
u u u u
+ +
= +

Scheme:
(i, j-1)


x

y





Exercise: 5

1. Solve numerically 4
xx tt
u u = with the boundary conditions (0, ) 0, (4, ) 0 u t u t = = and the initial
conditions ( , 0) 0 and ( , 0) (4 )
t
u x u x x x = = , taking 1 h = (up to 4 t = ).

(i-1, j)

(i, j) (i+1, j)


(i, j+1)

8


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
2. Solve 25 0
xx tt
u u = for u at the pivotal points, given (0, ) (5, ) 0, ( , 0) 0
t
u t u t u x = = = and
2 , for 0 2.5
( , 0)
10 2 for 2.5 5
x x
u x
x x
s s
=

s s

for one half period of vibration.



3. Evaluate the pivotal values of the following equation taking 1 h = and up to one half of the period
of the oscillation. 16
xx tt
u u = given
2
(0, ) (5, ) 0, ( , 0) (5 ) u t u t u x x x = = = and ( , 0) 0
t
u x = .

4. Solve
2 2
2 2
, 0 1, 0,
u u
x t
t x
c c
= < < >
c c
given ( , 0) ( , 0) (0, ) 0
t
u x u x u t = = = and (1, ) 100sin u t t t = .
Compute u for 4 time steps with 0.25 h = .


Solution of Laplaces Equation

The partial differential equation
2 2
2 2
0 or 0
xx yy
u u
u u
x y
c c
+ = + =
c c
is known as Laplaces equation.
Replacing the derivatives by the difference quotients we get

1, , 1, , 1 , , 1
2 2
2 2
0
i j i j i j i j i j i j
u u u u u u
h k
+ +
+ +
+ =

Taking a square mesh (i.e., h k = ) we get from the above formula

, 1, 1, , 1 , 1
1
4
i j i j i j i j i j
u u u u u
+ +
( = + + +



Therefore, the value of u at any interior mesh point is the arithmetic mean of its values at the four
neighbouring mesh points to the left, right, below and above. This is called the Standard Five Point
Formula (SFPF). We can also use the formula

, 1, 1 1, 1 1, 1 1, 1
1
4
i j i j i j i j i j
u u u u u
+ + + +
( = + + +



This formula involves the values on the diagonals through
. i j
u . It is called the Diagonal Five Point
Formula (DFPF).

We use these two formulae (SFPF and DFPF), to solve the Laplace equation 0
xx yy
u u + = in a
bounded square region when all the boundary values of u are given. Initially we find rough values at
the interior points and then we improve them by iterative process mostly using standard five point
formula. This iteration process of solving the Laplace equation is known as Liebmanns Iteration
Process.
9


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
Exercise: 6
1. Solve 0
xx yy
u u + = in 0 4, 0 4 x y s s s s given that
2
(0, ) 0, (4, ) 8 2 , ( , 0)
2
x
u y u y y u x = = + =
2
and ( , 4) u x x = . Take 1 h k = = and obtain the result correct to 3 decimals.

2. Solve the elliptic equation 0
xx yy
u u + = for the following square mesh with boundary values as
shown, using Liebmanns iteration process.
0 500 1000 500 0


1000 1000

2000 2000


1000 1000


0 500 1000 500 0

3. Solve the elliptic equation 0
xx yy
u u + = for the following square mesh with boundary values as
shown below. Iterate until the maximum difference between two successive values at any point is
less than 0.001. 1 2


1 2

2 1


2 1
4. Solve the elliptic equation 0
xx yy
u u + = for the following square mesh with boundary values as
shown in the figure. Iterate until the maximum difference between two successive values at any
point is less than 0.001. 1 2


1 4

2 5


4 5
u
1
u
2
u
3

u
4
u
5
u
6

u
7
u
8
u
9



u
1
u
2


u
3
u
4



u
1
u
2


u
3
u
4


10


Unit V Boundary Value Problems in Ordinary and Partial Differential Equations
Prepared by Dr. K.A. Selvakumaran
5. Solve 0
xx yy
u u + = over the square mesh of side 4 units, satisfying the following boundary
conditions:
i) (0, ) 0 for 0 4 u y y = s s
ii) (4, ) 12 for 0 4 u y y y = + s s
iii) ( , 0) 3 for 0 4 u x x x = s s
iv)
2
( , 4) for 0 4 u x x x = s s .


Solution of Poissons Equation

The partial differential equation
2 2
2
2 2
( , ) or ( , )
u u
f x y u f x y
x y
c c
+ = V =
c c
where ( , ) f x y is a
function of x, y is known as Poissons equation. Replacing the derivatives by difference expressions at
the points , x ih y jk = = we get
1, , 1, , 1 , , 1
2 2
2 2
( , ).
i j i j i j i j i j i j
u u u u u u
f ix jk
h k
+ +
+ +
+ =
If h k = , then
2
1, 1, , 1 , 1 ,
4 ( , )
i j i j i j i j i j
u u u u u h f ih jk
+ +
+ + + =

Applying the above formula at each square mesh we get a system of linear equations. By solving
these equations we get the solution of the given boundary value problem.


Exercise: 7

1. Solve the equation
2 2 2
10( 10) u x y V = + + over the square mesh with sides 0, 0, x y = =
3, 3 x y = = , with 0 u = on the boundary and mesh length 1 unit.

2. Solve
2 2 2
8 u x y V = over the square mesh with sides 2, 2, x y = = 2, 2 x y = = , with 0 u = on
the boundary and mesh length equal to 1 unit.

3. Solve the Poisson equation
2
4 u xy V = over the square mesh with sides 0, 0, x y = = 3, 3 x y = = ,
with 0 u = on the boundary and mesh length 1 unit.

You might also like