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

Similar documents
NUMERICAL DIFFERENTIATION

4.2 - Richardson Extrapolation

Numerical Differentiation

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 2. Predictor-Corrector Methods

Consider a function f we ll specify which assumptions we need to make about it in a minute. Let us reformulate the integral. 1 f(x) dx.

(4.2) -Richardson Extrapolation

Hermite Interpolation

MATH745 Fall MATH745 Fall

Runge-Kutta methods. With orders of Taylor methods yet without derivatives of f (t, y(t))

Floating Point Number Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

NUMERICAL DIFFERENTIATION. James T. Smith San Francisco State University. In calculus classes, you compute derivatives algebraically: for example,

AMS 147 Computational Methods and Applications Lecture 09 Copyright by Hongyun Wang, UCSC. Exact value. Effect of round-off error.

Chapter 5 FINITE DIFFERENCE METHOD (FDM)

MAT 1339-S14 Class 2

Exercises for numerical differentiation. Øyvind Ryan

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

First we will go over the following derivative rule. Theorem

LECTURE 14 NUMERICAL INTEGRATION. Find

158 Calculus and Structures

5.1 introduction problem : Given a function f(x), find a polynomial approximation p n (x).

MATH 155A FALL 13 PRACTICE MIDTERM 1 SOLUTIONS. needs to be non-zero, thus x 1. Also 1 +

1 Introduction to Optimization

A.P. CALCULUS (AB) Outline Chapter 3 (Derivatives)

Numerical Methods. King Saud University

Order of Accuracy. ũ h u Ch p, (1)

Polynomial Functions. Linear Functions. Precalculus: Linear and Quadratic Functions

Numerical di erentiation. Quentin Louveaux (ULg - Institut Montefiore) Numerical analysis / 12

Polynomial Interpolation

Section 2.7 Derivatives and Rates of Change Part II Section 2.8 The Derivative as a Function. at the point a, to be. = at time t = a is

Lecture 21. Numerical differentiation. f ( x+h) f ( x) h h

232 Calculus and Structures

Math 242: Principles of Analysis Fall 2016 Homework 7 Part B Solutions

Polynomial Interpolation

Convexity and Smoothness

We name Functions f (x) or g(x) etc.

MATH1901 Differential Calculus (Advanced)

Chapter 4: Numerical Methods for Common Mathematical Problems

Math Spring 2013 Solutions to Assignment # 3 Completion Date: Wednesday May 15, (1/z) 2 (1/z 1) 2 = lim

Parameter Fitted Scheme for Singularly Perturbed Delay Differential Equations

Math 212-Lecture 9. For a single-variable function z = f(x), the derivative is f (x) = lim h 0

FINITE DIFFERENCE APPROXIMATIONS FOR NONLINEAR FIRST ORDER PARTIAL DIFFERENTIAL EQUATIONS

Convexity and Smoothness

Function Composition and Chain Rules

Math 161 (33) - Final exam

Lecture XVII. Abstract We introduce the concept of directional derivative of a scalar function and discuss its relation with the gradient operator.

Chapter 1. Density Estimation

These error are made from replacing an infinite process by finite one.

Key Concepts. Important Techniques. 1. Average rate of change slope of a secant line. You will need two points ( a, the formula: to find value

Numerical Algorithms. IE 496 Lecture 20

Copyright c 2008 Kevin Long

Bob Brown Math 251 Calculus 1 Chapter 3, Section 1 Completed 1 CCBC Dundalk

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

Applications of the van Trees inequality to non-parametric estimation.

Differential Calculus (The basics) Prepared by Mr. C. Hull

= h. Geometrically this quantity represents the slope of the secant line connecting the points

Using the definition of the derivative of a function is quite tedious. f (x + h) f (x)

1 Lecture 13: The derivative as a function.

Solutions to the Multivariable Calculus and Linear Algebra problems on the Comprehensive Examination of January 31, 2014

HOMEWORK HELP 2 FOR MATH 151

. Compute the following limits.

LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION

Logarithmic functions

Finite Difference Method

MAT 145. Type of Calculator Used TI-89 Titanium 100 points Score 100 possible points

5 Ordinary Differential Equations: Finite Difference Methods for Boundary Problems

Section 3.1: Derivatives of Polynomials and Exponential Functions

Chapter Seven The Quantum Mechanical Simple Harmonic Oscillator

Math 112 Rahman. Week Taylor Series Suppose the function f has the following power series:

Math 1210 Midterm 1 January 31st, 2014

Differential equations. Differential equations

Name: Answer Key No calculators. Show your work! 1. (21 points) All answers should either be,, a (finite) real number, or DNE ( does not exist ).

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Physically Based Modeling: Principles and Practice Implicit Methods for Differential Equations

3.4 Worksheet: Proof of the Chain Rule NAME

2.8 The Derivative as a Function

Chapter 5 Differentiation

The total error in numerical differentiation

Polynomial Interpolation with n + 1 nodes

SECTION 3.2: DERIVATIVE FUNCTIONS and DIFFERENTIABILITY

LIMITS AND DERIVATIVES CONDITIONS FOR THE EXISTENCE OF A LIMIT

DEFINITION OF A DERIVATIVE

Poisson Equation in Sobolev Spaces

Exponential and logarithmic functions (pp ) () Supplement October 14, / 1. a and b positive real numbers and x and y real numbers.

Computer Derivations of Numerical Differentiation Formulae. Int. J. of Math. Education in Sci. and Tech., V 34, No 2 (March-April 2003), pp

Analytic Functions. Differentiable Functions of a Complex Variable

1 The concept of limits (p.217 p.229, p.242 p.249, p.255 p.256) 1.1 Limits Consider the function determined by the formula 3. x since at this point

The Derivative as a Function

0.1 The Slope of Nonlinear Function

MVT and Rolle s Theorem

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

160 Chapter 3: Differentiation

MAT01A1: Differentiation of Polynomials & Exponential Functions + the Product & Quotient Rules

Differential Equations

Chapter Primer on Differentiation

DELFT UNIVERSITY OF TECHNOLOGY Faculty of Electrical Engineering, Mathematics and Computer Science

Section 15.6 Directional Derivatives and the Gradient Vector

lecture 26: Richardson extrapolation

University Mathematics 2

Click here to see an animation of the derivative

CS522 - Partial Di erential Equations

Transcription:

Fall 2014 MAT 375 Numerical Metods (Capter 9)

Idea: Definition of te derivative at x Obviuos approximation: f (x) = lim 0 f (x + ) f (x) f (x) f (x + ) f (x) forward-difference formula? ow good is tis approximation wit respect to

Taylor s teorem: so f (x + ) = f (x) + f (x) + 2 2 f (ξ), ξ [x, x + ] f (x) = f (x + ) f (x) 2 f (ξ) Te term 2 f (ξ) is truncation/discretization error It is of order, so we ave 1st order approximation.

Let s generalize Mes on [a, b]: a = x 0 < x 1 < < x N 1 < x N = b, wit x i = a + i, step of discretization = (b a)/n Forward-difference formula f (x i ) f x,i = f (x i+1) f (x i ) Backward-difference formula f (x i ) f x,i = f (x i) f (x i 1 ) Centered-difference formula f (x i ) f x,i = f (x i+1) f (x i 1 ) 2

Truncation errors f x,i = f (x i ) + 2 f (ξ i ); f x,i = f (x i ) + 2 f (ξ i ) similar to f x,i For centered-difference formula: Taylor s teorem: f (x + ) = f (x) + f (x) + 2 2 f (x) + 3 6 f (ξ), ξ [x, x + ] f (x ) = f (x) f (x) + 2 2 f (x) 3 6 f (η), η [x, x] Ten for x = x i So f x,i = f (x i+1) f (x i 1 ) 2 = f (x i ) + 2 12 (f (ξ i ) + f (η i )) f x,i = f (x i ) + 2 6 f (ξ i ), 2nd degree ξ i [x i 1, x i+1 ]

Some conclusions Forward-difference formula: f x,i = f (x i) f (x i 1 ) Backward-difference formula: f x,i = f (x i+1) f (x i ) = f (x i ) + O() = f (x i ) + O() Centered-difference formula: f x,i = f (x i+1) f (x i 1 ) 2 = f (x i ) + O( 2 )

Examples: f (x) = e x at x = 1 f (x) = e x and f (1) = e at x = 1 Taking = 1/8: f (1) f x = e1+0.125 e 0.125 = 2.895480164 Errors: f (1) f x = e1+0.125 e 1 0.125 0.125 Err(f x ) = 0.17777... = 2.2536622 Err(f x ) = 7.084... 10 3

Wat appens if 0? Approximating f (x) for f (x) = e x at x = 1 1 f x Error f x Error 2 3.526814461-0.808532e+00 2.832967758-0.114686e+00 4 3.088244438-0.36996e+00 2.746685505-0.284037e-01 8 2.895481110-0.177199e+00 2.725366592-0.708484e-02 16 2.805027008-0.867452e-01 2.720052719-0.177097e-02 32 2.761199951-0.429182e-01 2.718723297-0.441551e-03 64 2.739639282-0.213575e-01 2.718391418-0.109672e-03 128 2.728942871-0.106611e-01 2.718307495-0.257492e-04 Conclusion: Error 0 as 0 and Err(f x ) < Err(f x ) (or Err(f x )) So if we take to be small, life is good. Or is it?

Wat about roundoff error? Let f (x) be te rounded value of f (x). Ten f (x) = f (x)(1 + ε) fx = f (x + ) f (x) f (x + ) f (x) = Since δ i < ε - macine epsilon Rounding error = f (x + )(1 + δ 1) f (x)(1 + δ 2 ) + δ 1f (x + ) δ 2 f (x) δ 1 f (x + ) δ 2 f (x) ε ( f (x + ) + f (x) ) ε Rounding error ε as 0 Is it te end of te world as we know it?

Best results: truncation error rounding error 2 f (ξ) ε ( f (x + ) + f (x) ) ε So ε ten Error ε

Example: Find f x for f (x) = sin x at x = π/3 f (π/3) = 0.5 ε 10 8

How about centered-difference f x? Let f (x) be te rounded value of f (x). Ten f (x) = f (x)(1 + ε) f x = f (x + ) f (x ) 2 f (x + ) f (x ) = 2 Since δ i < ε - macine epsilon Rounding error = f (x + )(1 + δ 1) f (x )(1 + δ 2 ) 2 + δ 1f (x + ) δ 2 f (x ) 2 δ 1 f (x + ) δ 2 f (x ) 2 ε 2 ( f (x + ) + f (x ) ) ε

Best results: truncation error rounding error 2 6 f (ξ) 2 ε ε ( f (x + ) + f (x ) ) 2 So ε 1/3 ten Error ε 2/3

Example: Find f x for f (x) = sin x at x = π/3 f (π/3) = 0.5 ε 1/3 10 5

Higer-order derivatives f (x i ) f xx,i = f x,i f x,i = f (x i+1) 2f (x i ) + f (x i 1 ) 2 Error: Taylor s expansion of f (x i+1 ) and f (x i 1 ) at point x i : f xx,i = f (x i ) + 2 12 f (4) (ξ i ) Truncation error 2 (2nd order) Rounding error ε 2 (ε is macine epsilon) Best results: ε 2 2 ε 1/4 wit Err ε (if ε 10 6, ten 10 4 )

Unappy conclusion: Operation of numerical differentiation is ill-conditioned: Error as 0 Solution: coose so tat truncation error rounding error

Using polynomial interpolation for numerical differentiation f (x) = p n (x) f (x) = p n(x)

Mes on [a, b]: a = x 0 < x 1 < < x n 1 < x n = b Lagrange form of interpolation polynomial: f (x) = p n (x) + R n (x) n = f (x k )L k (x) + (x x 0)... (x x n ) f (n+1) (ξ(x)) (n + 1)! k=1 wit L k (x) = n i=0 i k x x i x k x i Differentiate: n [ ] (x f (x) = f (x k )L k (x) + D x0 )... (x x n ) x f (n+1) (ξ(x)) (n + 1)! k=1 + (x x 0)... (x x n ) ] D x [f (n+1) (ξ(x)) (n + 1)!

f (x) = n [ ] (x f (x k )L k (x) + D x0 )... (x x n ) x f (n+1) (ξ(x)) (n + 1)! k=1 + (x x 0)... (x x n ) ] D x [f (n+1) (ξ(x)) (n + 1)! How to estimate te truncation error? If we take x = x i for i = 0,..., n ten (x x 0)... (x x n ) (n + 1)! = 0 Ten f (x i ) = n k=1 f (x k )L k (x i) + f (n+1) (ξ(x i )) (n + 1)! (n + 1)-point formula to approximate f (x i ) n (x i x j ) j=0 j i