0% found this document useful (0 votes)
50 views14 pages

Lectures 1&2

The document discusses the Finite Difference Method (FDM) for solving boundary value problems, emphasizing its numerical approach to differential equations when analytical solutions are difficult to obtain. It explains the concepts of initial and boundary value problems, reduction of higher order equations, and various numerical methods including Taylor's series and successive approximations. Additionally, it details the types of finite difference approximations (forward, backward, and central) and their applications in solving differential equations under different boundary conditions.

Uploaded by

vasudhabhuva1296
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views14 pages

Lectures 1&2

The document discusses the Finite Difference Method (FDM) for solving boundary value problems, emphasizing its numerical approach to differential equations when analytical solutions are difficult to obtain. It explains the concepts of initial and boundary value problems, reduction of higher order equations, and various numerical methods including Taylor's series and successive approximations. Additionally, it details the types of finite difference approximations (forward, backward, and central) and their applications in solving differential equations under different boundary conditions.

Uploaded by

vasudhabhuva1296
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Finite Difference Method for Boundary Value Problems

1 Preliminary
What is Numerical Method?
• Numerical method is an approach for solving various mathematical problems involving differential
equations, curve fitting, integrals and root findings through approximations rather than exact
solutions.
• For solving mathematical problems by numerical method, an input is provided in the form of
some numerical data or it is generated/created as called for by the problem.

Why Numerical Method ?


• Due to the increasing complexities encountered in the development of modern technology, ana-
lytical solutions usually are not available.

• To avoid such difficulties, numerical solutions are obtained using high-speed computer, especially
when the geometry of the object of interest is irregular, or the boundary conditions are nonlinear.

Ordinary Differential Equations:


An ordinary differential equation (ODE) may be expressed as:

dy d2 y d3 y dn y
 
f x, y, , 2 , 3 , . . . , n = 0
dx dx dx dx

where f is a function of independent variables x, dependent variable y, and its derivatives.


A differential equation is called of order n, if the order of highest derivative is n.
Its degree is equal to the power of the highest order derivative provided neither y nor its derivative
appear under radical sign.
Before determining the degree of an ODE, equation should be made free of radical signs containing
y and its derivatives.
Example: r
d2 y dy
2
+ +y =0
dx dx
is of order two and also of degree two since after removing square root, it is expressed as:
2
d2 y d2 y

dy
+ 2y − + y2 = 0
dx2 dx2 dx

Initial Value & Boundary Value Problem


Assume an ordinary differential equation (ODE) written as:

dn y dy d2 y d3 y dn−1 y
 
= f x, y, , 2 , 3 , . . . , n−1 (1)
dxn dx dx dx dx

1
Santanu Manna MA 204N: Finite Difference Method

Its general solution will contain n arbitrary constants, which can be determined uniquely if n
conditions are prescribed.
If these conditions are prescribed at a single point i.e., solution is required in an open domain, then
such problems are called Initial Value Problems (IVPs).
If these conditions are prescribed at two or more points i.e., solution is required in a bounded
domain, then such problems are called Boundary Value Problems (BVPs).
A problem is said to be well-posed if the number of prescribed conditions are exactly same as the
order of the equation.

Reduction of Higher Order IVPs to First Order Equations


Assume nth order initial value problem
dn y
= f (x, y, y ′ , y ′′ , . . . , y (n−1) ) (2)
dxn
with initial conditions prescribed at x = x0 ,
(n−1)
y(x0 ) = y0 , y ′ (x0 ) = y0′ , y ′′ (x0 ) = y0′′ , . . . , y (n−1) (x0 ) = y0 (3)

Introducing new variables z1 , z2 , . . . , zn−1 , where:

dy d2 y d3 y dn−1 y
z1 = , z2 = , z3 = , . . . , z n−1 =
dx dx2 dx3 dxn−1
So that the equation can be reduced to a system of n simultaneous equations of the first order,
given as:
dy
= z1
dx

2
Santanu Manna MA 204N: Finite Difference Method

Preliminary: Method of Successive Approximation


Picard’s Method
Consider IVP of the form:
dy
= f (x, y), x > x0 (1.5)
dx
y = y0 , at x = x0 (1.6)
Integrating eq. (1.5) from x0 to x and using eq. (1.6), we get:
Z x
y(x) − y(x0 ) = f (x, y) dx (1.7)
x0

Solution to eq. (1.7) is obtained in an iterative manner as:


Z x h i
y (n+1) (x) = y0 + f x, y (n) (x) dx, n = 0, 1, 2, . . . (1.8)
x0

Where y (n) (x) denotes the nth iteration and y0 = y(x0 ).

For example,

x
x3 x2 x3 x4
Z   
y (2) (x) = 1 + x2 − 1 − x + dx = 1 − x + + −
x0 3 2 3 12
x2 x4
Error = y (2) (x) − y (1) (x) = −
2 12
Max. error at x = 0.2:
(0.2)2 (0.2)4
− > 10−3 ⇒ Go for next iteration
2 12

x
x2 x3 x4
Z   
y (3) (x) = 1 + x2 − 1 − x + + − dx
x0 2 3 12
x2 x3 x4 x5
=1−x+ + − +
2 6 12 60

x3 x5
Error = y (3) (x) − y (2) (x) = − + > 10−3
6 60

3
Santanu Manna MA 204N: Finite Difference Method

Taylor’s Series Method


Consider IVP of the form:
dy
= f (x, y), x > x0 (1.5)
dx
y = y0 , at x = x0 (1.6)
The value of y at some point x, close to x0 , can be found using a Taylor’s series expansion:

(x − x0 )2 ′′ (x − x0 )3 ′′′ (x − x0 )n (n)
y(x) = y0 + (x − x0 )y0′ + y0 + y0 + · · · + y0 (1.9)
2! 3! n!
With a remainder term:
(x − x0 )n+1 (n+1)
R= f (ξ), x0 ≤ ξ ≤ x (1.10)
(n + 1)!

To find the values of y0′ , y0′′ , y0′′′ , . . . , we proceed in the following manner:

• y0 = y(x0 ), given as initial condition


• y0′ = f (x0 , y0 ), to be found from the differential equation.

• y0′′ to be found by differentiating the differential equation once as:

y0′′ = (y ′′ )(x0 ,y0 ) = (fx + fy · f )(x0 ,y0 )

• y0′′′ is computed by differentiating y0′′ in the following manner:

y0′′′ = (y ′′′ )(x0 ,y0 ) = fxx + (y ′ )2 fyy + 2y ′ fxy + y ′′ fy )(x0 ,y0 )

By putting the values of y0′ , y0′′ , y0′′′ , . . ., we get the solution in the form of a power series, which
will be valid in the neighbourhood of x0 . This method is an approximate analytical method.

Taylor’s Series Method: Example


Obtain the first five terms in the Taylor’s series as solution of equation
dy 1
= (x2 + y 2 ), y(0) = 1,
dx 2
Also discuss the truncation error in the interval [0, 0.1].
Solution: Given: f (x, y) = 21 (x2 + y 2 ); x0 = 0, y0 = 1 therefore

fx = x, fy = y, fxx = 1, fxy = 0, fyy = 1

Now,
1 1 7 (iv) 5
y0′ = f (x0 , y0 ) = , y0′′ = x + yy ′ = , y0′′′ = 1 + yy ′′ + y ′ y ′ = , y0 = yy ′′′ + 3y ′ y ′′ =
2 2 4 2
The Taylor’s series solution is given by:

x x2 7x3 5x4
y(x) = 1 + + + +
2 4 24 48
The truncation error will be of order O(x5 ), i.e., O(10−5 ) for x = 0.1.

4
Santanu Manna MA 204N: Finite Difference Method

2 Overview of Finite Difference Method (FDM)


• The Finite Difference Method (FDM) is a numerical method for solving ODE and PDE by
approximating them with difference equations.
• It is especially useful for problems where analytical solutions are hard or impossible to find.
• It is widely used in engineering, physics, and applied mathematics.
• The basic idea is to discretize the continuous domain into a grid and replace derivatives
with finite difference approximations.

2.1 Taylor Series Expansions


Using Taylor series:

h2 ′′ h3 ′′′
y(xi + h) = yi + hyi′ + y + y + ... (4)
2 i 6 i
h2 h3 ′′′
y(xi − h) = yi − hyi′ + yi′′ − y + ... (5)
2 6 i
Subtracting and adding the above equations gives the finite difference approximations:

yi+1 − yi−1
yi′ ≈ (6)
2h
′′ yi+1 − 2yi + yi−1
yi ≈ (7)
h2

2.2 Discretized Equation


f1 (x)y ′′ + f2 (x)y ′ + f3 (x)y = r(x) (8)
Substitute the finite differences into the original differential equation (12):
   
yi+1 − 2yi + yi−1 yi+1 − yi−1
f1 (xi ) + f (x
2 i ) + f3 (xi )yi = r(xi ) (9)
h2 2h
Multiplying through and rearranging gives:

[2f1 (xi ) − hf2 (xi )] yi−1 + 2h2 f3 (xi ) − 4f1 (xi ) yi + [2f1 (xi ) + hf2 (xi )] yi+1 = 2h2 r(xi )
 
(10)

for i = 1, 2, . . . , n − 1

2.3 Types of Finite Difference Approximations


Forward Difference
The forward difference uses the function value at the current and next grid point to approximate the
derivative.
For a function y(x), at a point xi with step size h, the derivatives can be approximated as:
First Derivative:
yi+1 − yi
y ′ (xi ) ≈
h
Second Derivative (from two forward steps):
yi+2 − 2yi+1 + yi
y ′′ (xi ) ≈
h2

5
Santanu Manna MA 204N: Finite Difference Method

Backward Difference
The backward difference uses the function value at the current and previous grid point.
First Derivative:
yi − yi−1
y ′ (xi ) ≈
h
Second Derivative (from two backward steps):
yi − 2yi−1 + yi−2
y ′′ (xi ) ≈
h2

Central Difference
The central difference uses the average of forward and backward differences, providing higher accuracy
(second-order).
First Derivative:
yi+1 − yi−1
y ′ (xi ) ≈
2h
Second Derivative:
yi+1 − 2yi + yi−1
y ′′ (xi ) ≈
h2

Comparison
• Forward and Backward differences are first-order accurate.
• Central difference is second-order accurate and generally preferred when applicable.

2.4 Different Boundary Value Problems (BVPs)


Let’s consider a second-order linear differential equation:

f1 (x)y ′′ + f2 (x)y ′ + f3 (x)y = r(x) (11)

with the boundary conditions:


1. y(x0 ) = y0 and y(xn ) = yn (Dirichlet’s conditions)
2. y ′ (x0 ) = y0 and y ′ (xn ) = yn (Neumann conditions)
3. y ′ (x0 ) = y0 and y(xn ) = yn (One side Dirichlet’s condition)

4. y(x0 ) = y0 and y ′ (xn ) = yn (One side Dirichlet’s condition)


5. y(x0 ) = y0 and y(xn ) + y ′ (xn ) = b (Mixed conditions)
6. y(x0 ) + y ′ (x0 ) = a and y ′ (xn ) = yn (Mixed conditions)

6
Santanu Manna MA 204N: Finite Difference Method

3 Finite Difference Method (Dirichlet Problem)


The method consists of dividing the interval (x0 , xn ) into n subintervals at the points
x1 , x2 , . . . , xn−1 such that xi = x0 + ih.
Let the differential equation be
f1 (x)y ′′ + f2 (x)y ′ + f3 (x)y = r(x) (12)
which requires solving under the boundary conditions
y(x0 ) = y0 and y(xn ) = yn .
We require the solution y(xi ), i = 1, 2, . . . , n − 1.

Let us assume that y(xi ) = yi , We have to discretize the equation (12). Since eq. (12) is satisfied
by (xi , yi ), we may write
f1 (xi )y ′′ (xi ) + f2 (xi )y ′ (xi ) + f3 (xi )yi = r(xi ) (13)
Now by Taylor’s series we have
h2 ′′ h3
yi (xi + h) = yi + hyi′ (xi ) + yi (xi ) + yi′′′ (xi ) + . . . (14)
2 3!
and
h2 ′′ h3
yi (xi − h) = yi − hyi′ (xi ) + yi (xi ) − yi′′′ (xi ) + . . . (15)
2 3!
Subtracting the two expansions, we get
yi (xi + h) − yi (xi − h)
yi′ (xi ) = + O(h2 ) (16)
2h
or
yi+1 − yi−1
yi′ = where yi±1 = yi (xi ± h) (17)
2h
Putting two Taylor’s series expansions (14), we get
yi+1 − 2yi + yi−1
yi′′ (xi ) = + O(h2 ) (18)
h2
Using Eqs. (12) and (17) in Eq. (14), we get
(iv) yi−2 − 4yi−1 + 6yi − 4yi+1 + yi+2
yi (xi ) = + O(h2 ) (19)
h4
These are the finite difference equivalences of first, second, and fourth derivatives at any point.
Now replacing yi′ and yi′′ of Eq. (12) by their finite difference equivalents given in Eqs. (17) and
(18), we get
   
yi+1 − 2yi + yi−1 yi+1 − yi−1
f1 (xi ) + f (x
2 i ) + f3 (xi )yi = r(xi ) (20)
h2 2h
On arranging, equation (20) gives:

[2f1 (xi ) − hf2 (xi )] yi−1 + 2h2 f3 (xi ) − 4f1 (xi ) yi +


 
(21)
[2f1 (xi ) + hf2 (xi )] yi+1 = 2h2 r(xi ), i = 1, 2, . . . , (n − 1)
Equation (21) gives (n − 1) linear equations. The number of unknowns in these equations is n + 1
(y0 , y1 , . . . , yn ). The values of two unknowns will be determined by the boundary conditions y(x0 ) = y0
and y(xn ) = yn . The numerical values of y0 and yn are known and the rest (n − 1) unknowns may be
obtained by solving (n − 1) equations using Eq. (21).

7
Santanu Manna MA 204N: Finite Difference Method

Example:
Solve:

xy ′′ + 3y ′ + (1 + x)y = 1 + x2 , 0<x<4
with boundary conditions:
y(0) = 1, y(4) = 0
Let h = 1, x0 = 0, x4 = 4, so the nodes are x1 = 1, x2 = 2, x3 = 3.
Discretizing using finite differences:

   
yi+1 − 2yi + yi−1 yi+1 − yi−1
xi +2 + (1 + xi )yi = 1 + x2i
h2 2h

At i = 1, x1 = 1:

−y0 + 5y1 = 4 (iv)


At i = 2, x2 = 2:

y1 − 2y2 + 7y3 = 10 (v)


At i = 3, x3 = 3:

y2 + y4 = 10 (similar derivation)
Given y0 = 1, y4 = 0, solve the linear system to find y1 , y2 , y3 .

Examples of Boundary Value Problem with Dirichlet’s Condition


Example : Solve the equation
xy ′′ + 3y ′ + (1 + x)y = 1 + x2
with boundary conditions:
y(0) = 1, y(4) = 0 at x = 1, 2, 3.
Solution:
Here h = 1, y0 = 1, y4 = 0, x0 = 0, x4 = 4.
Divide the interval (0, 4) at the points x1 = 1, x2 = 2, and x3 = 3. Our aim is to find the
corresponding values of y, i.e., y1 , y2 , y3 by the finite difference method using the discretized Eqs.
(9.33) and (9.34).
We have:
xi yi′′ + 3yi′ + (1 + xi )yi = 1 + x2i (ii)
Using Eqs. (9.33) and (9.34) in (ii), we get:
   
yi+1 − 2yi + yi−1 yi+1 − yi−1
xi + 2 + (1 + xi )yi = 1 + x2i (ii’)
h2 2h

Here h = 1, so arranging Eq. (ii’), we get:

(2xi − 3)yi−1 + 2(1 − xi )yi + (2xi + 3)yi+1 = 2(1 + x2i ) (iii)

Taking i = 1, x1 = 1, we get:
−y0 + 5y1 = 4 (iv)
Taking i = 2, x2 = 2, we get:
y1 − 2y2 + 7y3 = 10 (v)

8
Santanu Manna MA 204N: Finite Difference Method

Taking i = 2 and x3 = 3, we get:


3y2 − 4y3 + 9y4 = 20 (vi)
Now the Eqs. (iv), (v) and (vi) have five unknowns. Out of which the values of two unknowns,
namely y0 and y4 are given in the boundary conditions:

y(0) = 1 and y(4) = 0

Thus, y0 = 1 and y4 = 0. Using these values in (i) and (iii), we get:

y2 = 1
−y0 + 5y2 = 4 ⇒ −1 + 5y2 = 4 ⇒ y2 = 1

y1 − 2y2 + 7y3 = 10 ⇒ y1 − 2(1) + 7y3 = 10 ⇒ y1 + 7y3 = 12 (v)

17
3y2 − 4y3 + 9y4 = 20 ⇒ 3(1) − 4y3 = 20 ⇒ −4y3 = 17 ⇒ y3 = −
4
Substituting into (v):
 
17 119 167
y1 + 7 − = 12 ⇒ y1 = 12 + =
4 4 4

Final Solution Table


x 0 1 2 3 4
167
y 1 4 1 − 17
4 0
This is the solution of the problem.

Example:
Solve the boundary value problem:

d2 y
= −π 2 y, 0<x<1
dx2
with derivative boundary conditions:

y ′ (0) = 0, y ′ (1) = 0

These are Neumann boundary conditions specifying zero slope at both ends.

Derivative Boundary Conditions (Neumann Conditions)


1. If the boundary condition is given in derivative form, e.g., y ′ (4) = β, then y4 becomes an
unknown.
2. We need to consider the equations for i = 1, 2, 3, 4, i.e., a total of four equations must be formed.
3. If we try to form an equation at i = 4, it involves y5 , introducing another unknown. But we
avoid this by using the derivative boundary condition.
4. The Neumann condition y ′ (4) = β can be approximated using forward difference as:
y5 − y3
=β ⇒ y5 = y3 + 2hβ
2h

9
Santanu Manna MA 204N: Finite Difference Method

5. Substituting y5 in the equation at i = 4 gives us an equation in y1 , y2 , y3 , y4 , which can be solved


using Gaussian elimination.
6. If the derivative boundary is at the left end, say y ′ (0) = α, then y0 is also unknown, and we form
equations from i = 0, 1, 2, 3, 4.

7. Starting at i = 0 introduces a fictitious point y−1 , which we eliminate using:


y1 − y−1
y ′ (0) = α ≈ ⇒ y−1 = y1 − 2hα
2h

8. Substituting y−1 in the equation at i = 0, we now have equations involving y0 , y1 , y2 , y3 , y4 .


9. If derivative conditions are at both ends: y ′ (0) = α, y ′ (4) = β, then we need to form equations
for i = 0, 1, 2, 3, 4.
10. The unknowns will be: y−1 , y0 , y1 , y2 , y3 , y4 , y5 , but we use the boundary conditions to eliminate
y−1 and y5 :
y−1 = y0 − 2hα, y5 = y3 + 2hβ

11. Thus, we are left with five equations in five unknowns: y0 , y1 , y2 , y3 , y4 , which can be solved
uniquely.

Finite Difference Method: Neumann BVP


Solve:
d2 y
= −π 2 y, 0<x<1
dx2
with boundary conditions:
y ′ (0) = 0, y ′ (1) = 0

Step 1: Discretization
1
Let the interval [0, 1] be divided into N parts with step size h = N. Let yi ≈ y(xi ), where xi = ih.

Step 2: Finite Difference Approximation


d2 y yi+1 − 2yi + yi−1
≈ ⇒ yi−1 − (2 + h2 π 2 )yi + yi+1 = 0
dx2 xi h2

Step 3: Neumann Boundary Conditions


y1 − y0
y ′ (0) ≈ = 0 ⇒ y1 = y0
h
yN − yN −1
y ′ (1) ≈ = 0 ⇒ yN = yN −1
h

Step 4: Matrix Form (Example for N = 4)


−(1 + h2 π 2 )
    
1 0 y1 0
 1 −(2 + h2 π 2 ) 1  y2  = 0
0 1 −(1 + h2 π 2 ) y3 0
This linear system can be solved for y1 , y2 , y3 . Since it is homogeneous, the solution is determined
up to a multiplicative constant.

10
Santanu Manna MA 204N: Finite Difference Method

Example
Solve the equation
1 2
y ′′ − xy = 1 at x = 0, ,
3 3
with boundary conditions:
y(0) + y ′ (0) = 1, y(1) = 2

Solution:
Here, h = 31 , so the equivalent finite difference equation becomes:
yi−1 − 2yi + yi+1
− xi yi = 1
(1/3)2
or,
x  1
i
yi−1 + + 2 yi + yi+1 = (i)
9 9
Now putting i = 0, 1, 2, we get:
1
y−1 − 2y0 + y1 = (x0 = 0)
9
 
1 1
y0 − + 2 y1 + y2 = (x1 = 1/3) (ii)
27 9
 
2 1
y1 − + 1 y2 + y3 = (x2 = 2/3)
27 9
Given: y3 = 2
Using the boundary condition y(0) + y ′ (0) = 1, we approximate the derivative using forward
difference:
y1 − y−1 y1 − y−1 3
y ′ (0) ≈ = 1 = (y1 − y−1 )
2h 2× 3 2
3
y0 + (y1 − y−1 ) = 1
2
Solving for y−1 :
2y0 + 3y1 − 2
y−1 = (iii)
3

Linear System of Equations


Hence, the linear equations giving the solution of the problem are as follows:
−12y0 + 18y1 = 5
27y0 − 55y1 + 27y2 = 3
27y1 − 56y2 = −51

Tridiagonal Matrix System


The tridiagonal system giving the solution of the problem is as follows:
    
−12 18 0 y0 5
 27 −55 27  y1  =  3 
0 27 −56 y2 −51
which may be solved easily.

11
Santanu Manna MA 204N: Finite Difference Method

Example
Solve the equation
1
y ′′ + (1 + x)y ′ − y = 0, y(0) = y ′ (0), y(1) + y ′ (1) = 1, with h =
2

Solution
We have the differential equation:
y ′′ + (1 + x)y ′ − y = 0 (i)
Taking finite difference approximations, we get:
1 1
(yi−1 − 2yi + yi+1 ) + (1 + xi ) · (yi+1 − yi−1 ) − yi = 0
h2 2h
Putting h = 21 , we get:

4(yi−1 − 2yi + yi+1 ) + (1 + xi )(yi+1 − yi−1 ) − yi = 0 (ii)

Putting i = 1

4(y0 − 2y1 + y2 ) + (1 + x1 )(y2 − y0 ) − y1 = 0


1
With x1 = , we get:
2
3 3
⇒ 4y0 − 8y1 + 4y2 + y2 − y0 − y1 = 0
2 2
5 11
⇒ y0 − 9y1 + y2 = 0 (iii)
2 2

Putting i = 2

4(y1 − 2y2 + y3 ) + (1 + x2 )(y3 − y1 ) − y2 = 0


With x2 = 1, we get:
⇒ 4y1 − 8y2 + 4y3 + 2y3 − 2y1 − y2 = 0
⇒ 2y1 − 9y2 + 6y3 = 0 (iv)

Boundary Conditions
From the condition y(0) = y ′ (0), using forward difference:
1 1
y0 = y0′ = (y1 − y−1 ) ⇒ y0 = (y1 − y−1 ) ⇒ y−1 = y1 − hy0 ⇒ y0 = y1 − y−1 (v)
h h
From this, solving gives:
2
y0 =
y1 (vi)
3
From the condition y(1) + y ′ (1) = 1, using backward difference:
1 1 + 2y1 − y2
y2 + (y3 − y1 ) = 1 ⇒ y2 + 2(y3 − y1 ) = 1 ⇒ y3 = (vii)
h 2

12
Santanu Manna MA 204N: Finite Difference Method

Substituting in (iii)
Substitute y0 = 23 y1 into (iii):
5 2 11
· y1 − 9y1 + y2 = 0
2 3 2
10 11
⇒ y1 − 9y1 + y2 = 0
6 2
8 11
⇒ − y1 + y2 = 0 (viii)
3 2

Substituting (vii) into (iv)


 
1 + 2y1 − y2
2y1 − 9y2 + 6 =0
2
⇒ 2y1 − 9y2 + 3(1 + 2y1 − y2 ) = 0
⇒ 2y1 − 9y2 + 3 + 6y1 − 3y2 = 0
⇒ 8y1 − 12y2 + 3 = 0
⇒ 8y1 − 12y2 = −3 (ix)
Now you can solve equations (viii) and (ix) as a system of two equations in y1 and y2 .

Solving the System


From the previous equations:
5 11
y0 − 9y1 + y2 = 0 (iii)
2 2
Using the substitution y0 = 32 y1 :
5 2 11 8 11

· y1 − 9y1 + y2 = 0 ⇒ − y1 + y2 = 0 (x)
2 3 2 3 2
And from the boundary condition at x = 1:

8y1 − 12y2 = −3 (xi)


On solving Eqs. (x) and (xi), we get:
1 2
y1 =
= 0.5 and y2 = = 0.66
2 3
Putting y1 and y2 in Eq. (iii), we get:
2 2 1 1
y0 = · y1 = · = = 0.33
3 3 2 3

Hence,

y0 = 0.33
y1 = 0.5
y2 = 0.66

(Further values possibly from another method like Runge-Kutta or Taylor


series):
y0 = 1, y1 = 0.9939, y2 = 1.3782, y3 = 2.0631, y4 = 3

13
Santanu Manna MA 204N: Finite Difference Method

4 Summary
• Dirichlet conditions fix the values of the solution at the boundaries.

• They are the simplest to implement in numerical methods.


• No ghost points or extra approximations needed.
• Used often in physical problems where the state at the boundaries is known (e.g., fixed temper-
ature at the ends of a rod).

• Neumann boundary conditions specify slopes, not function values.

• They are common in physical problems involving flux, temperature gradients, etc.
• Finite difference methods handle them using derivative approximations.
• May introduce extra (”ghost”) points, which are eliminated by substitution.

Advantages
Simple and easy to implement.

Good for problems with regular geometry.

Especially effective for linear differential equations.

Limitations
Less accurate for irregular geometries.

Can be inefficient for high-dimensional problems.

May need very fine grids for accuracy, increasing computation time.

14

You might also like