0% found this document useful (0 votes)
375 views

Introduction To Finite Difference Method

The document introduces the finite difference method for numerically solving differential equations. It discusses how the finite difference method approximates derivatives using finite differences and Taylor series approximations. Examples are provided to demonstrate approximating the first and second derivatives of functions like sin(x) at different points using finite difference formulas of increasing order accuracy. The accuracy of the approximations increases as the step size h decreases. Machine exercises derive basic one-sided finite difference formulas and test them on examples to check the theoretical orders of accuracy.

Uploaded by

Julius Baniqued
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
375 views

Introduction To Finite Difference Method

The document introduces the finite difference method for numerically solving differential equations. It discusses how the finite difference method approximates derivatives using finite differences and Taylor series approximations. Examples are provided to demonstrate approximating the first and second derivatives of functions like sin(x) at different points using finite difference formulas of increasing order accuracy. The accuracy of the approximations increases as the step size h decreases. Machine exercises derive basic one-sided finite difference formulas and test them on examples to check the theoretical orders of accuracy.

Uploaded by

Julius Baniqued
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

INTRODUCTION TO

FINITE DIFFERENCE
METHOD
Two Methods in Solving
Differential Equations
■ Analytical
– Only few equations can be solved
– Too hard
■ Numerical
– Can be done to vast majority of differential equations
– Will have some error
Numerical Methods

■ Finite Difference Method


– replacing the derivatives in the equation by appropriate numerical
differentiation formula
■ Finite Element Method
– To be discussed
Finite Difference
Approximation
Given u = u(x),
𝑑𝑢 𝑢 𝑥 + ℎ − 𝑢(𝑥)
= 𝑢′ (𝑥) = lim
𝑑𝑥 ℎ→0 ℎ

𝑢 𝑥 + ℎ − 𝑢(𝑥)
𝑢′ 𝑥 ≈

Finite Difference
Approximation


𝑢 𝑥 + ℎ − 𝑢(𝑥)
𝑢 𝑥 ≈

Recall Taylor Series

∞ 𝑛
𝑓 𝑎
𝑓 𝑥 =෍ (𝑥 − 𝑎)𝑛
𝑛!
𝑛=0

∞ 𝑛
𝑢 𝑥
𝑢 𝑥+ℎ = ෍ (ℎ)𝑛
𝑛!
𝑛=0
Taylor Series

■ First Order Taylor Expansion


𝑢 𝑥 + ℎ ≈ 𝑢 𝑥 + 𝑢′ 𝑥 ℎ


𝑢 𝑥 + ℎ − 𝑢(𝑥)
𝑢 𝑥 ≈


𝑢 𝑥+ℎ −𝑢 𝑥
𝑢 𝑥 = + 𝑂(ℎ)

Example

■ Given that u(x) = sin x. Approximate u’(1).


Taylor Series for Second Order
Differential Equation
ℎ2 ℎ 3
𝑢 𝑥 + ℎ = 𝑢 𝑥 + 𝑢′ 𝑥 ℎ + 𝑢′′ 𝑥 + 𝑢′′′ 𝑥 + 𝑂 ℎ4
2 6

2 3
ℎ ℎ
𝑢 𝑥 − ℎ = 𝑢 𝑥 − 𝑢′ 𝑥 ℎ + 𝑢′′ 𝑥 − 𝑢′′′ 𝑥 + 𝑂 ℎ4
2 6

𝑢 𝑥 + ℎ + 𝑢 𝑥 − ℎ = 2𝑢 𝑥 + 𝑢′′ 𝑥 ℎ2 + 𝑂 ℎ4

𝑢 𝑥 + ℎ − 2𝑢 𝑥 + 𝑢(𝑥 − ℎ)
𝑢′′ 𝑥 = + 𝑂(ℎ 2)
ℎ2
Example

2
■ Given 𝑢 𝑥 = 𝑒 𝑥 . Approximate u’’(1).

■ Try h = 0.00001?
– Why is the error higher?
Improving u’(x) Approximation

ℎ2
𝑢 𝑥 + ℎ = 𝑢 𝑥 + 𝑢′ 𝑥 ℎ + 𝑢′′ 𝑥 + 𝑂 ℎ3
2

ℎ 2
𝑢 𝑥 − ℎ = 𝑢 𝑥 − 𝑢′ 𝑥 ℎ + 𝑢′′ 𝑥 + 𝑂 ℎ3
2

𝑢 𝑥 + ℎ − 𝑢 𝑥 − ℎ = 2𝑢′ 𝑥 ℎ + 𝑂 ℎ3

𝑢 𝑥 + ℎ − 𝑢(𝑥 − ℎ)
𝑢′ 𝑥 = + 𝑂(ℎ2 )
2ℎ
Example

■ Given that u(x) = sin x. Approximate u’(1).


Machine Exercise
■ Derive some basic one-sided finite difference formulas, which are used for
approximating derivatives of functions at or near the boundary of their domain.
– Construct a finite difference formula that approximates the derivative u’(x)
using the values of u(x) at the points x, x + h, and x + 2h.
 What is the order of your formula?
– Find a finite difference formula for u’’(x) that involves the same three function
values.
 What is its order?
– Test your formulas by computing approximations to the first and second
derivatives of u(x) = sin x at x = 1 using step sizes h = 0.1, 0.01, and 0.001.
 What is the error in your numerical approximations? Are the errors compatible with
the theoretical orders of the finite difference formulas? Discuss why or why not.
Machine Exercise Solution

𝑢′′(𝑥) 2

𝑢 𝑥+ℎ =𝑢 𝑥 +𝑢 𝑥 ℎ+ ℎ + 𝑂 ℎ3
2

𝑢′′ 𝑥
𝑢 𝑥 + 2ℎ = 𝑢 𝑥 + 𝑢′ 𝑥 2ℎ + 4ℎ2 + 𝑂 ℎ3
2
Machine Exercise Solution

−4𝑢 𝑥 + ℎ + 𝑢 𝑥 + 2ℎ = −3𝑢 𝑥 − 2𝑢′ 𝑥 ℎ + 𝑂 ℎ3


−3𝑢 𝑥 + 4𝑢 𝑥 + ℎ − 𝑢 𝑥 + 2ℎ
𝑢 𝑥 = + 𝑂 ℎ2
2ℎ
Machine Exercise Solution

−2𝑢 𝑥 + ℎ + 𝑢 𝑥 + 2ℎ = −𝑢 𝑥 + 𝑢′′ 𝑥 ℎ2 + 𝑂 ℎ3


𝑢 𝑥 − 2𝑢 𝑥 + ℎ + 𝑢 𝑥 + 2ℎ
𝑢 𝑥 = +𝑂 ℎ
ℎ2

You might also like