This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Math 257: Finite difference methods 1 Finite Differences Remember the definition of a derivative f ( x ) = lim Δ x → f ( x + Δ x ) f ( x ) Δ x (1) Also recall Taylor’s formula: f ( x + Δ x ) = f ( x ) + Δ xf ( x ) + Δ x 2 2! f 00 ( x ) + Δ x 3 3! f (3) ( x ) + ... (2) or, with Δ x instead of +Δ x : f ( x Δ x ) = f ( x ) Δ xf ( x ) + Δ x 2 2! f 00 ( x ) Δ x 3 3! f (3) ( x ) + ... (3) Forward difference On a computer, derivatives are approximated by finite difference expressions; rearrang ing (2) gives the forward difference approximation f ( x + Δ x ) f ( x ) Δ x = f ( x ) + O (Δ x ) , (4) where O (Δ x ) means ‘terms of order Δ x ’, ie. terms which have size similar to or smaller than Δ x when Δ x is small. 1 So the expression on the left approximates the derivative of f at x , and has an error of size Δ x ; the approximation is said to be ‘first order accurate’. 1 The strict mathematical definition of O ( δ ) is to say that it represents terms y such that lim δ → y δ is finite. So δ 2 and δ are O ( δ ), but δ 1 / 2 or 1, for instance, are not. Another commonly used notation is o ( δ ), which represents terms y for which lim δ → y δ = 0 . In other words, o ( δ ) represents terms that are strictly smaller than δ as δ → 0. So δ 2 is o ( δ ), but δ is not. 1 Backward difference Rearranging (3) similarly gives the backward difference approximation f ( x ) f ( x Δ x ) Δ x = f ( x ) + O (Δ x ) , (5) which is also first order accurate, since the error is of order Δ x . Centered difference Combining (2) and (3) gives the centered difference approximation f ( x + Δ x ) f ( x Δ x ) 2Δ x = f ( x ) + O (Δ x 2 ) , (6) which is ‘second order accurate’, because the error this time is of order Δ x 2 . Second derivative, centered difference Adding (2) and (3) gives f ( x + Δ x ) + f ( x Δ x ) = 2 f ( x ) + Δ x 2 f 00 ( x ) + Δ x 4 12 f (4) ( x ) + ... (7) Rearranging this therefore gives the centered difference approximation to the second derivative: f ( x + Δ x ) 2 f ( x ) + f ( x Δ x ) Δ x 2 = f 00 ( x ) + O (Δ x 2 ) , (8) which is second order accurate. 2 Heat Equation Dirichlet boundary conditions To find a numerical solution to the heat equation ∂u ∂t = α 2 ∂ 2 u ∂x 2 , < x < L, (9) u (0 ,t ) = A, u ( L,t ) = B, u ( x, 0) = f ( x ) , (10) approximate the time derivative using forward differences, and the spatial derivative using centered differences;...
View
Full Document
 Spring '11
 lo
 Math, Derivative, UK, Boundary value problem, Boundary conditions, Dirichlet boundary condition

Click to edit the document details