Finite Difference Method
ME710 Mathematical Methods for Engineers
Mechanical Engineering
NITK Surathkal
Adapted from
Introduction
Introduction
• Connection between difference equations and differential
equations.
• A typical row in our matrices has the entries - 1 , 2, - 1 .
• These numbers are producing a second difference.
• The second difference gives a natural approximation to the
second derivative.
• The matrices Kn and Cn and Tn and Bn are all involved in
approximating the equation
• Notice that the variable is x and not t. This is a boundary-value
problem and not an initial-value problem.
• There are boundary conditions at x = 0 and x = 1 , not initial
conditions at t = 0.
Finite Differences
• How can we approximate du/dx, the slope of a function u(x)?
• The function might be known, like u(x) = x2. The function might be
unknown, inside a differential equation.
• We have to work with Δu/Δx without taking the limit as Δx 0.
• So we have "finite differences" where calculus has derivatives.
• Three different possibilities for Δu are basic and useful.
• For u = x2 , the centered difference is the winner. It gives the exact
derivative 2x, while forward and backward miss by h.
Finite Difference
• Centered is generally more accurate than one-sided, when h = Δx is
small. The reason is in the Taylor series approximation of u(x + h) and
u(x - h) .
Second difference from first differences
• Find a finite difference approximation to this linear second order
differential equation:
• The derivative of the derivative is the second derivative. d/dx of
(du/dx) is d2u/dx2.
• It is natural that the first difference of the first difference should be
the second difference.
Accuracy of approximation
• Dividing by h2, Δ2u/ Δx2 has second order accuracy
(error ch2u ’’’’) .
Finite Difference Equations
• We have an approximation Δ2u/ Δx2 to the second derivative d2u/dx2.
• So we can quickly create a discrete form of - d2u/dx2 = f(x) .
• Divide the interval [0, 1] into equal pieces of length h =Δx.
• If that mesh length is h = 1/(n+1), then n + 1 short subintervals will meet at
x=h, x=2h, . . . , x = nh.
• The extreme endpoints are x = 0 and x = (n + 1)h = 1 .
• The goal is to compute approximations u1 , . . . , un to the true values
u(h) , . . . , u(nh) at those n mesh points inside the [0, 1] interval.
Finite Difference Equations
• The first equation (i = 1) involves u0. The last equation (i = n )
involves Un+1·
• The boundary conditions given at x = 0 and x = 1 will determine
what to do.
• We now solve the key examples with fixed ends u(O) = u0 = 0 and u(1)
= Un+1= 0.
Example 1-Analytical Solution
Example1: Finite Difference Method
Example1: Finite Difference Method
Example1: Finite Difference Method
Example1: Finite Difference Method
Example 2: Free Clamped
Example2: Finite Difference Method
Example2: Finite Difference Method
Example2: Finite Difference Method
Example 2