Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i

Similar documents
FINITE DIFFERENCES. Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations.

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ).

Numerical Methods. King Saud University

2.2. Methods for Obtaining FD Expressions. There are several methods, and we will look at a few:

Lecture 4.2 Finite Difference Approximation

Second Order ODEs. CSCC51H- Numerical Approx, Int and ODEs p.130/177

Polynomial Interpolation with n + 1 nodes

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Consistency and Convergence

Finite Differences: Consistency, Stability and Convergence

f (x) = k=0 f (0) = k=0 k=0 a k k(0) k 1 = a 1 a 1 = f (0). a k k(k 1)x k 2, k=2 a k k(k 1)(0) k 2 = 2a 2 a 2 = f (0) 2 a k k(k 1)(k 2)x k 3, k=3

5. FVM discretization and Solution Procedure

Interpolation and Approximation

LECTURE 14 NUMERICAL INTEGRATION. Find

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx,

APPLICATIONS OF FD APPROXIMATIONS FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS

Applied Numerical Analysis Quiz #2

Applied Math for Engineers

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9)

Midterm for Introduction to Numerical Analysis I, AMSC/CMSC 466, on 10/29/2015

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20

Chap. 19: Numerical Differentiation

Euler s Method, cont d

Identification Methods for Structural Systems. Prof. Dr. Eleni Chatzi Lecture March, 2016

Jim Lambers MAT 772 Fall Semester Lecture 21 Notes

Hermite Interpolation

2.29 Numerical Fluid Mechanics Fall 2009 Lecture 13

Chapter 8: Taylor s theorem and L Hospital s rule

Fixed point iteration and root finding

MATH 614 Dynamical Systems and Chaos Lecture 2: Periodic points. Hyperbolicity.

TS Method Summary. T k (x,y j 1 ) f(x j 1,y j 1 )+ 2 f (x j 1,y j 1 ) + k 1

Lecture 38. Almost Linear Systems

Finite Difference Calculus

Preliminary Examination in Numerical Analysis

Chapter Two: Numerical Methods for Elliptic PDEs. 1 Finite Difference Methods for Elliptic PDEs

Ordinary Differential Equations I

MA2501 Numerical Methods Spring 2015

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Computational Methods. Solving Equations

2.3. Quantitative Properties of Finite Difference Schemes. Reading: Tannehill et al. Sections and

SKMM 3023 Applied Numerical Methods

Numerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018

Numerical Methods - Initial Value Problems for ODEs

3.1 Interpolation and the Lagrange Polynomial

Review: control, feedback, etc. Today s topic: state-space models of systems; linearization

Lecture V: The game-engine loop & Time Integration

Scientific Computing: An Introductory Survey

Introduction to PDEs and Numerical Methods Tutorial 4. Finite difference methods stability, concsistency, convergence

Numerical Differentiation

Chapter 5: Numerical Integration and Differentiation

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 1. Runge-Kutta Methods

Numerical Methods for Differential Equations

Do not turn over until you are told to do so by the Invigilator.

Module 3: BASICS OF CFD. Part A: Finite Difference Methods

Numerical Solution of Linear Fredholm Integro-Differential Equations by Non-standard Finite Difference Method

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Lecture 5: Single Step Methods

Ordinary Differential Equations I

Ordinary Differential Equations

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Differential Equations

Ordinary Differential Equations

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

Solution to the exam in TFY4275/FY8907 CLASSICAL TRANSPORT THEORY May 20, 2011

Simpson s 1/3 Rule Simpson s 1/3 rule assumes 3 equispaced data/interpolation/integration points

, applyingl Hospital s Rule again x 0 2 cos(x) xsinx

Practice Exam 2 (Solutions)

Cubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines

Finite difference models: one dimension

Fourth Order RK-Method

Numerical Analysis Preliminary Exam 10.00am 1.00pm, January 19, 2018

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Lecture 5: Function Approximation: Taylor Series

Condensed Matter Physics Prof. G. Rangarajan Department of Physics Indian Institute of Technology, Madras

Taylor Series. Math114. March 1, Department of Mathematics, University of Kentucky. Math114 Lecture 18 1/ 13

Ordinary Differential Equations II

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

Review for Final. The final will be about 20% from chapter 2, 30% from chapter 3, and 50% from chapter 4. Below are the topics to study:

PART II : Least-Squares Approximation

Selected HW Solutions

Numerical Solution Techniques in Mechanical and Aerospace Engineering

COSC 3361 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods

Linear Multistep Methods I: Adams and BDF Methods

Mini project ODE, TANA22

Partial Differential Equations

MATH 409 Advanced Calculus I Lecture 16: Mean value theorem. Taylor s formula.

Finite Difference Methods (FDMs) 1

Woods Hole Methods of Computational Neuroscience. Differential Equations and Linear Algebra. Lecture Notes

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Chapter 5 FINITE DIFFERENCE METHOD (FDM)

Lecture IV: Time Discretization

Numerical Methods in Physics and Astrophysics

Finite Difference Methods for Boundary Value Problems

Solving Ordinary Differential equations

Section x7 +

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

PHYS 301 HOMEWORK #8

Lecture Notes for Math 251: ODE and PDE. Lecture 27: 7.8 Repeated Eigenvalues

Transcription:

LECTURE 6 NUMERICAL DIFFERENTIATION To find discrete approximations to differentiation (since computers can only deal with functional values at discrete points) Uses of numerical differentiation To represent the terms in o.d.e. s and p.d.e. s in a discrete manner Many error estimates include derivatives of a function. This function is typically not available, but values of the function at discrete points are. Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i f(x) x -2 - + +2 x i-2 x i- x i x i+ x i+2 node i-- i i+ i+2 p. 6.

Node index i indicates which node or point in space-time we are considering (here only one spatial or temporal direction) i 0 20 2 N=22 i=0,n i=, N For equi-spaced nodal points, h = x i + x i Taylor Series Expansion for f(x) About a Typical Node i fx = fx i x f x 2 + x i + -------------------f 2 x 2! i + x 3 -------------------f 3 3! x i x 4 + ------------------- f 4 x 5 x 4! i -------------------f 5 x 6 + + x 5! i + -------------------f 6 x 6! i + p. 6.2

For the present analysis we will consider only the first four terms of the T.S. expansion (may have to consider more) fx = fx i x f x 2 x i -------------------f 2 x 3 + + x 2! i + -------------------f 3 x 3! i + E where E = x 4 -------------------f 4 4! x i x 5 -------------------f 5 x 6 + x 5! i + -------------------f 6 x 6! i + E x 4 = -------------------f 4 x 4! i x E x 4 -------------------f 4 4! x i E Ox 4 If the Taylor series is convergent, each subsequent term in the error series should be becoming smaller. p. 6.3

The terms in the error series may be expressed Exactly as E We note that the value of is not known This single term exactly represents all the truncated terms in the Taylor series Approximately as x 4 = -------------------f 4 4! x 4 E -------------------f 4 4! x i This is the leading order truncated term in the series This approximation for the error can also be thought of as being derived from the exact single term representation of the error with the approximation f 4 f 4 x i In terms of an order of magnitude only as E Ox 4 This term is often carried simply to ensure that all terms of the correct order have been carried in the derivations. This error term is indicative of how the error relatively depends on the size of the interval! p. 6.4

Evaluate fx i + fx i x i + f x i + 2 = + x i + --------------------------- f 2 2! fx i + x i x i + 3 + --------------------------- f 3 x 3! i + Ox i + 4 2 3 + = + h + ----f + ----f 6 i + h 2 h 3 Oh 4 Evaluate fx i + 2 fx i x i + 2 f x i + 2 2 = + x i + --------------------------- f 2 2! fx i + 2 x i x i + 2 3 + --------------------------- f 3 x 3! i + Ox i + 2 4 + 2h 2h 2 2 --h 3 3 = + + + f 3 i + 2 4 Oh 4 p. 6.5

Evaluate fx i = fx i + x i f x i + fx i x i 2 ---------------------------f 2 2! x i x i 3 + --------------------------- f 3 x 3! i + Ox i 4 = h + h 2 2 ----f h 3 3 ----f 6 i + Oh 4 Similarly we can evaluate fx i 2 2h 2h 2 2 = + 2 4 --h 3 3 f 3 i + Oh 4 p. 6.6

Approximating Derivatives by Linearly Combining Functional Values at Nodes Forward first order accurate approximation to the first derivative Consider 2 nodes, i and i + + i i+ Combine the difference of the functional values at these two nodes 2 3 + = + h + ----f + ----f 6 i + h 2 h 3 Oh 4 h = h 2 2 h 3 3 + ----f ----f 6 i + Oh 4 + = ------------------ h h 2 3 --f ----f 6 i + Oh 3 h 2 p. 6.7

First derivative of f at node i is approximated as + = ------------------- + E where E h h --f 2 This is the first forward difference and the error is called first order in h (i.e. E Oh ) f(x) actual slope () + x i x i+ = x i +h Notes: There is a clear dependence of the error on h h approximate slope + - h The first forward difference approximation is exact for st degree polynomials p. 6.8

Backward first order accurate approximation to the first derivative Consider nodes i and i and define = hf i h 2 2 3 + ----f ----f 6 i + Oh 4 h 3 = h h 2 First backward difference of s then defined as: 2 ----f h 3 3 + ----f 6 i + Oh 4 = ------------------ + E h Error is again first order in h E = 2 --hf Oh p. 6.9

Central second order accurate approximation to the first derivative Consider nodes i, i and i + and examine + 2 3 = + h + ----f + ----f 6 i + Oh 4 f 2 3 i h + ----f ----f 6 i + Oh 4 + h 2 + h 3 = 2h Central difference approximation to the first derivative is h 3 3 + ----f 3 i + Oh 4 h 2 h 3 ------------------------- + E 2h + = Formula has an error which is second order in h E = h 2 3 ---- f 6 i Oh 2 p. 6.0

f actual slope () + i- - i i+ approximate slope + - - 2h x The smaller h, the smaller the error Error is obviously generally better for the central Oh 2 formula than the forward or backward Oh formulae! Expression is exact for 2nd degree polynomials due to the third derivative in the expression for E p. 6.

Strictly the order of the error is indicative of the rate of convergence as opposed to the absolute error log(e)=log( () - F.D. approx) st order 2nd order 2 log h p. 6.2

Forward first order accurate approximation to the second derivative Now consider nodes i, i + and i + 2 and the linear combination of functional values + 2 2 + + + 2 2 + + 2h 2h 2 2 --h 3 3 = + + + f 6 i + Oh 4 + 2 2 + Forward difference approximation to second derivative 8 2 2 h ----f --h 3 3 + + + f 6 i + Oh 4 + f i h 2 + h 2 2 h 3 3 = + Oh 4 + --------------------------------------- + E 2 + 2 2 + = h 2 Error first order in h 3 E = h = Oh p. 6.3

TABLE OF DIFFERENCE APPROXIMATIONS First Derivative Approximations Forward difference approximations: + 2 = ------------------ + E, E --hf h Backward difference approximations: + + 4 + 3 = ---------------------------------------------- + E, E 2h 3 --h2 3 2 + 9 + 2 + 8 + = -------------------------------------------------------------------- + E, E -- h 3 4 f 6h 4 i 2 3 = ------------------ + E, E h 2 --hf 2 i 3 4 + 2 = ----------------------------------------- + E, E 2h 3 --h2 3 8 + 9 2 2 3 = --------------------------------------------------------------------- + E, E 6h 4 --h3 4 p. 6.4

Central difference approximations: + = ------------------------- + E, E --h 2 3 f 2h 6 i + + 8 + 8 + 2 = --------------------------------------------------------------------- + E, E 2h 2 -----h 4 5 f 30 i Second Derivative Approximations Forward difference approximations + 2 + + 3 = -------------------------------------- + E, E h 2 2 h 2 + + 4 + 2 5 + + 2 = ------------------------------------------------------------------ + E, E -----h 2 4 f 2 3 h 2 p. 6.5

Backward difference approximations: 2 + 2 3 = ------------------------------------- + E, E h 2 h 2 2 5 + 4 2 3 = ------------------------------------------------------------ + E, E -----h 2 4 f 2 h 2 Central difference approximations: + 2 + = -------------------------------------- + E, E -----h 2 4 f 2 h 2 + + 6 + 30 + 6 2 = ------------------------------------------------------------------------------------------, 2h 2 + E E 2 2 -----h 4 6 f 90 i All the derivative approximations we have examined are linear combinations of functional values at nodes!! What is a general technique for finding the associated coefficients? p. 6.6