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

Similar documents
Investigation of Tangent Polynomials with a Computer Algebra System The AMATYC Review, Vol. 14, No. 1, Fall 1992, pp

Taylor Series and the Mean Value Theorem of Derivatives

Numerical Differentiation

How to Find the Derivative of a Function: Calculus 1

Continuity and Differentiability

Section 3.1: Derivatives of Polynomials and Exponential Functions

LIMITS AND DERIVATIVES CONDITIONS FOR THE EXISTENCE OF A LIMIT

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.

Chapter 2 Limits and Continuity. Section 2.1 Rates of Change and Limits (pp ) Section Quick Review 2.1

LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION

Midterm #1B. x 8 < < x 8 < 11 3 < x < x > x < 5 or 3 2x > 5 2x < 8 2x > 2

On One Justification on the Use of Hybrids for the Solution of First Order Initial Value Problems of Ordinary Differential Equations

5.1 The derivative or the gradient of a curve. Definition and finding the gradient from first principles

Differentiation Rules c 2002 Donald Kreider and Dwight Lahr

3.4 Worksheet: Proof of the Chain Rule NAME

Differentiation. introduction to limits

158 Calculus and Structures

The total error in numerical differentiation

Exercises for numerical differentiation. Øyvind Ryan

Recall from our discussion of continuity in lecture a function is continuous at a point x = a if and only if

Introduction to Derivatives

Conductance from Transmission Probability

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

Material for Difference Quotient

UNIT #6 EXPONENTS, EXPONENTS, AND MORE EXPONENTS REVIEW QUESTIONS

Solving Continuous Linear Least-Squares Problems by Iterated Projection

4.2 - Richardson Extrapolation

(4.2) -Richardson Extrapolation

Polynomial Interpolation

Continuity. Example 1

Chapter 5 FINITE DIFFERENCE METHOD (FDM)

lecture 26: Richardson extrapolation

Krazy Katt, the mechanical cat

The derivative function

DIFFERENTIAL POLYNOMIALS GENERATED BY SECOND ORDER LINEAR DIFFERENTIAL EQUATIONS

Combining functions: algebraic methods

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

ETNA Kent State University

Lab 6 Derivatives and Mutant Bacteria

1watt=1W=1kg m 2 /s 3

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

Finite Difference Formulae for Unequal Sub- Intervals Using Lagrange s Interpolation Formula

2.11 That s So Derivative

MATH1901 Differential Calculus (Advanced)

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

Click here to see an animation of the derivative

Symmetry Labeling of Molecular Energies

232 Calculus and Structures

Precalculus Test 2 Practice Questions Page 1. Note: You can expect other types of questions on the test than the ones presented here!

Polynomial Interpolation

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

4. The slope of the line 2x 7y = 8 is (a) 2/7 (b) 7/2 (c) 2 (d) 2/7 (e) None of these.

Copyright c 2008 Kevin Long

LECTURE 14 NUMERICAL INTEGRATION. Find

Chapter 1D - Rational Expressions

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

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

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

Observability Analysis of Nonlinear Systems Using Pseudo-Linear Transformation

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

5.1 We will begin this section with the definition of a rational expression. We

Mathematics 5 Worksheet 11 Geometry, Tangency, and the Derivative

Some Review Problems for First Midterm Mathematics 1300, Calculus 1

SECTION 1.10: DIFFERENCE QUOTIENTS LEARNING OBJECTIVES

De-Coupler Design for an Interacting Tanks System

Average Rate of Change

NUMERICAL DIFFERENTIATION

1. Consider the trigonometric function f(t) whose graph is shown below. Write down a possible formula for f(t).

Function Composition and Chain Rules

A = h w (1) Error Analysis Physics 141

MATH745 Fall MATH745 Fall

Math 1241 Calculus Test 1

arxiv:math/ v1 [math.ca] 1 Oct 2003

RightStart Mathematics

2.3 Algebraic approach to limits

Chapter 2 Limits and Continuity

The Laplace equation, cylindrically or spherically symmetric case

Quaternion Dynamics, Part 1 Functions, Derivatives, and Integrals. Gary D. Simpson. rev 01 Aug 08, 2016.

Derivation Of The Schwarzschild Radius Without General Relativity

Chapter 2. Limits and Continuity 16( ) 16( 9) = = 001. Section 2.1 Rates of Change and Limits (pp ) Quick Review 2.1

Solutions Manual for Precalculus An Investigation of Functions

The Derivative The rate of change

INTRODUCTION AND MATHEMATICAL CONCEPTS

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

Logarithmic functions

MVT and Rolle s Theorem

SECTION 3.2: DERIVATIVE FUNCTIONS and DIFFERENTIABILITY

Finding and Using Derivative The shortcuts

Time (hours) Morphine sulfate (mg)

Mathematics 105 Calculus I. Exam 1. February 13, Solution Guide

THE STURM-LIOUVILLE-TRANSFORMATION FOR THE SOLUTION OF VECTOR PARTIAL DIFFERENTIAL EQUATIONS. L. Trautmann, R. Rabenstein

Handling Missing Data on Asymmetric Distribution

NONLINEAR SYSTEMS IDENTIFICATION USING THE VOLTERRA MODEL. Georgeta Budura

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

f a h f a h h lim lim

Chapter 2 Ising Model for Ferromagnetism

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

MAT244 - Ordinary Di erential Equations - Summer 2016 Assignment 2 Due: July 20, 2016

Variational Methods for Time Dependent Wave Propagation Problems

MATH 1020 Answer Key TEST 2 VERSION B Fall Printed Name: Section #: Instructor:

Transcription:

Computer Derivations o Numerical Dierentiation Formulae By Jon H. Matews Department o Matematics Caliornia State University Fullerton USA Int. J. o Mat. Education in Sci. and Tec. V No (Marc-April ) pp.8-87. Traditional "pencil and paper" derivations o te numerical dierentiation ormulas or '[x and ''[x ave been done independently as i tere was no connection among te two derivations. Tis new approac gives a parallel development o te ormulas. It requires te solution o a "linear system" tat includes symbolic quantities as coeicients and constants. It is sown ow te power o a computer algebra system suc as Matematica can be used to elegantly solve tis linear system or '[x and ''[x. Te extension to derivations o iger order numerical dierentiation ormulas or te central orward or backward dierences are also presented.. Te tree point central dierence ormulas. Using tree points [x - [x and [x + we give a parallel development o te numerical dierentiation ormulas or '[x and ''[x. Start wit te Taylor series or [x + expanded in powers o o suiciently ig degree so tat a remainder suitable or te derivation is included. Te degree n = will suice. n=; Series[[x +{n} () [x + '[x + ''[x + [x + [x + O[ n+ 5 5 Te Matematica notation or te remainder term is O[ = O[. Te term O[ is removed rom te series wit te command Normal and a Taylor polynomial o degree n= is ormed. s[_=normal[series[[x +{n} () [x + '[x + ''[x + [x + [x 5 Construct two "equations" by setting te series equal to te unction at x = x ±. eqns={s[-==[x - s[==[x +} () { [x - '[x + ''[x - [x + [x == [- + x () [x + '[x + ''[x + [x + [x == [ + x } We ave two equations in te two unknowns '[x and ''[x and all te oter quantities [x [x [x + [x () and [x are considered as constants. Now use te Matematica command "Solve" to solve or '[x and ''[x.

solset=solve[eqns{'[x ''[x } {{ '[x ''[x [- + x - [ + x + [x () [x - [- + x - [ + x + [x - }} Te result is not too easy to read so we can use te commands ExpandAll and Collect to manipulate te ormula. In te print statements we add "+..." to remind us tat we are using truncated ininite series. Te ollowing commands will create a niceer looking printout or te above solution. sol = Collect[ExpandAll[solset [[ ; sol [[ = Togeter[sol [[ ; sol = Collect[ExpandAll[solset [[ ; Print[" '[x = "sol" +..."; Print["''[x = "sol" +..."; - [- + x + [ + x '[x = - [x +... - [x + [- + x + [ + x () ''[x = - [x +... Tus we ave derived te numerical dierentiation ormula or '[x and ''[x and te irst term in te series expansion or te remainder wic involves [x () or [x respectively. Since te "numerical dierentiation ormulae" are "truncated" ininite series we know tat te ellipses "..." means tat tere are ininitely many more term wic are not sown. Wen we do not include te "..." we must evaluate te lowest order derivative in te series or te remainder at te value x = c instead o x = x ten we can "cop o" te ininite series at te term involving [c or () [c respectively. Te Matematica command ReplaceAll is used to accomplis tis task. sol = ReplaceAll[Take[sol (k_) [x -> (k) [c; sol = ReplaceAll[Take[sol (k_) [x -> (k) [c; Print[" '[x = "sol; Print["''[x = "sol; - [- + x + [ + x '[x = - - [x + [- + x + [ + x ''[x = - [c () [c Tereore we ave establised te numerical dierentiation ormulas [x + - [x - '[x = - [c [x - - [x + [x + ''[x = - () [c

And te corresponding ormulas wit te big "O" notation O[ are [x + - [x - '[x = + O[ [x - - [x + [x + ''[x = + O[. Comparison wit te traditional derivations. Te above derivation diers only sligtly rom te traditional derivations wic also start wit te two equations () () [x - = [x - '[x + ''[x - [x + [x +L () [x + = [x + '[x + ''[x + [x + [x +L Wen deriving te numerical dierentiation ormula or '[x te equations () are subtracted and te terms involving ''[x cancel and manipulations are used to solve or '[x and its truncation error term. Te traditional derivation o te numerical dierentiation ormula or ''[x starts wit te same equations (). But tis time te equations are added and te terms involving '[x cancel and manipulations are used to solve or ''[x and its truncation error term. Tis is no "big deal" made about te act tat te starting place is te same. We sall see or te iger order ormulas tat using te same starting place will be te key to successul computer derivations o numerical dierentiation ormulas.. Te ive point central dierence ormulas. Using ive points [x - [x - [x [x + and [x + we can give a parallel development o te numerical dierentiation ormulas or '[x ''[x [x () and [x. Start wit te Taylor series or [x + expanded in powers o o suiciently ig degree so a remainder suitable or te n+ 7 derivation is included. Te degree n = will suice. Since te remainder term is O[ = O[ we will use Matematica's Normal command to remove it rom te series and orm te Taylor polynomial o degree n =. k=; n=k+; s[_ = Normal[Series[[x +{n} () 5 (5) () [x + '[x + ''[x + [x + [x + [x + [x 7

Use ive points and set up te "equations" by setting s[x +k == [x +k or k = -- wic is automated by using Matematica's Table command. Altoug te value k= will produce [x +k==[x wic is te boolean value True it will do no arm wen solving te set o equations and we will see tat te generations o iger order ormulas wic require more complicated sets o equations is more easily automated wit te use o a table. eqns=table[s[j == [x + j {j-kk} { () 5 (5) () [x - '[x + ''[x - [x + [x - [x + [x == [- + x 5 5 () 5 (5) () [x - '[x + ''[x - [x + [x - [x + [x == [- + x 7 True () 5 (5) () [x + '[x + ''[x + [x + [x + [x + [x == [ + x 7 () 5 (5) () [x + '[x + ' '[x + [x + [x + [x + [x == [ + x } 5 5 We can consider tat tese are our equations in te our unknowns '[x ''[x [x (5) and all te oter quantities [x [x [x [x + [x + [x constants. Now use Matematica to solve or '[x ''[x [x () and [x () and [x are () and [x. Since tis requires typing o our derivatives to be solved we will automate tis process too by using a table to construct te "variables." vars = Table[ (k) [x {kk} {'[x ''[x [x () [x } Amazingly te algebra involved in solving te our equations will result in te cancellation o in te odd order derivatives and te term will cancel in te even order derivatives. Tis can be accomplised using Matematica's Solve procedure. solset=solve[eqnsvars {{ '[x ''[x 5 (5) - 5[- + x + [- + x - [ + x + 5 [ + x - [x - 5 [x + 5[- + x - [- + x- [ + x + 5 [ + x - - 8 5 (5) [- + x - [- + x + [ + x - [ + x + [x [x - () [x

() [x }} - - [x - [- + x + [- + x + [ + x - [ + x + ( )[x Te output is not too clear to read so we sall use te ormula manipulation commands ExpandAll and Collect to group te numerical dierentiation portion and ten use te ReplaceAll command to (5) () cange [x and [x to (5) [c and () [c ten a inal use o Togeter will clean up te numerical dierentiation ormula part. All tis will be accomplised in te ollowing tree Matematica commands. I te reader is curious about exactly wat is appening in eac step ten te semi-colons can be deleted and te results o eac operation will be sown. solset [[All = Collect[ExpandAll[solset [[All ; solset [[All = ReplaceAll[solset [[All (i_)[x ->(i)[c; solset [[All = Togeter[solset [[All ; solset [- + x - 8[- + x + 8 [ + x - [ + x (5) {{ '[x + [c - [x - [- + x + [- + x + [ + x - [ + x () ''[x + [c 9 - [- + x + [- + x - [ + x + [ + x (5) [x - [c () [x + [- + x - [- + x - [ + x + [ + x () [x - [c }} Notice tat te ormula or approximating '[x and ''[x ave truncation error terms involving so tey () are numerical dierentiation ormulas o order O[. But te ormula or approximating [x and [x ave truncation error terms involving one o te many surprises in te teory o numerical analysis. so tey are numerical dierentiation ormulas o order O[. Tis is Tereore we ave establised te numerical dierentiation ormulas [x - -8 [x - + 8[ + x - [x + (5) '[x = + [c - [x - + [x - - [x + [x + - [x + ''[x = + 9 - [x - + [x - - [x + + [x + (5) [x = - [c () [x - - [x - + [x - [x + + [x + () [x = - [c. () [c

Tese ormulas can be written wit te big "O" notation O[ and O[ i desired. [x - -8 [x - + 8 [ + x - [x + '[x = + O[ - [x - + [x - - [x + [x + - [x + ''[x = + O[ - [x - + [x - - [x + + [x + [x = + O[ () [x - - [x - + [x - [x + + [x + [x = + O[.. Appendix. Subroutines or generating numerical dierentiation ormulae. Te central dierence ormulae use an odd number o points m = k+ and an even number o n = k equations. Since we want to inclued te remainder terms we need to use series expansions o order n = k+. Te remainder term in tese ormulas all involve even powers o and even and odd derivatives depending on te situation. Also te subroutine requires a replacement o te point were te remainder term is evaluated to be x=c instead o x=x. CentralDi[k_ := Module[{k=k} Clear[jnsx; s[_=normal[series[[x +{k}; eqns=table[s[j == [x + j {j-kk}; vars = Table[ (k) [x {kk}; solset=solve[eqnsvars; solset=mapall[togetersolset; Print[TableForm[solset [[ ;; Now te ormulas or te ive point central dierence ormulae can be generated automatically by typing te ollowing Matematica command: CentralDi[ [- + x - 8[- + x + 8 [ + x - [ + x '[x + - [x - [- + x + [- + x + [ + x ''[x - [- + x + [- + x - [ + x + [ + x [x [x + [- + x - [- + x - [ + x + [ [x - [ (5) + x + () + - x [c (5) - [c 9 () [c () [c

Tese ormulas are in agreement wit our previous derivation. Using te subroutine will automate te more diicult derivations. Te reader is encouraged to use te subroutine and type te command () CentralDi[. Te result will be six equations or '[x up to [x. Once we ave te idea or making te subroutine or te central dierence ormulas all we need to do is modiy te set o equations wit orward step sizes or backward step sizes and we can make subroutines or generating te orward and backward dierence ormulaes. ForwardDi[k_ := Module[{k=k} Clear[ijnsx; s[_=normal[series[[x +{k+}; eqns=table[s[j ==[x + j {jk}; vars = Table[(k)[x {kk}; solset=solve[eqnsvars; solset [[All =Collect[ExpandAll[solset [[All ; solset [[All =ReplaceAll[solset [[All (i_) [x -> (i) [c; solset [[All =Togeter[solset [[All ; Print[TableForm[solset [[ ;; BackwardDi[k_ := Module[{k=k} Clear[jnsx; s[_=normal[series[[x +{k+}; eqns=table[s[-j ==[x -j {jk}; vars = Table[(k)[x {kk}; solset=solve[eqnsvars; solset [[All =Collect[ExpandAll[solset [[All ; solset [[All =ReplaceAll[solset [[All (i_) [ x -> (i) [c; solset [[All =Togeter[solset [[All ; Print[TableForm[solset [[ ; ; Dut to te lengty nature o te ormulas wic are output rom te subroutines we leave it to te reader to experiment wit te subroutines ForwardDi and BackwardDi.

Numerical Metods Using Matlab t Edition Jon H. Matews and Kurtis K. Fink ISBN: --58- Prentice-Hall Inc. Upper Saddle River New Jersey USA ttp://vig.prenall.com/