Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Numerical Differentiation-Numerical Methods in Engineering-Lecture 11 Slides-Civil Engineering and Geological Sciences, Slides of Numerical Methods in Engineering

Numerical Differentiation, Taylor Series Expansion, Taylor Series, Approximating Derivatives, Actual Slope, Approximate Slope, Forward Difference Approximations, Backward Difference Approximations, First Derivative Approximations, Central Difference Approximations, Second Derivative Approximations

Typology: Slides

2011/2012

Uploaded on 02/20/2012

damyen
damyen 🇺🇸

4.4

(27)

274 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CE 341/441 - Lecture 11 - Fall 2004
p. 11.1
LECTURE 11
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
() fi
fi-2
f
i-1
f
i
f
i+1
f
i+2
x
i-2
x
i-1
x
i
x
i+1
x
i+2
f(x)
x
node i-2 i-1 i i+1 i+2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Numerical Differentiation-Numerical Methods in Engineering-Lecture 11 Slides-Civil Engineering and Geological Sciences and more Slides Numerical Methods in Engineering in PDF only on Docsity!

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

LECTURE 11NUMERICAL 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

f^

x

i (^

)^

f^

i

fi-

f^ i-

f^ i

fi+

f^ i+

x

i-

x

i-

x

i^

x

i+

x

i+

f(x) x node

i-

i-

i^

i+

i+

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

• Node index

i

indicates which node or point in space-time we are considering

(here only one spatial or temporal direction)

• For equi-spaced nodal points,

Taylor Series Expansion for

f(x)

About a Typical Node

i

_______________________________________________

i^

i^

N=

i=1, N

i=0,N

h

x

i^

1

x

i

f^

x (^

)^

f^

x

i (^

)^

x

x

i

(^

)^

f^

(^1) (

)^

x

i (^

)^

x

x

i

(^

-^

f^

(^2) (

)^

x

i (^

)^

x

x

i

(^

-^

f^

(^3) (

)^

x

i (^

x

x

i

(^

f^

(^4) (

)^

x

i (^

)^

x

x

i

(^

-^

f^

(^5) (

)^

x

i (^

)^

x

x

i

(^

-^

f^

(^6) (

)^

x

i (^

)^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

• The terms in the error series may be expressed

• Exactly as

• We note that the value of

is not known

• This single term exactly represents all the truncated terms in the Taylor series

• Approximately as

• 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

• In terms of an

order

of magnitude only as

• 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!

E

x

x

i

(^

-^

f^

(^4) (

)^

ξ(

ξ

E

x

x

i

(^

-^

f^

(^4) (

)^

x

i (^

f^

(^4) ( )

ξ (^

)^

f^

(^4) ( )

x

i (^

E

O x

x

i

(^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

• Evaluate

• Evaluate

f^

x

i^

1

(^

f^

x

i^

1

(^

)^

f^

x

i (^

)^

x

i^

1

x

i

(^

)^

f^

(^1) (

)^

x

i (^

)^

x

i^

1 +^

x

i

(^

-^

f^

(^2) (

)^

x

i (^

x

i^

1 +^

x

i

(^

-^

f^

(^3) (

)^

x

i (^

)^

O x

i^

1 +^

x

i

(^

f^

i^

1

f^

i^

h f

i

(^1) (

)^

h

-^

f^

(^2) ( (^) i

)^

h

-^

f^

(^3) ( (^) i

)^

O h

(^

f^

x

i^

2

(^

f^

x

i^

2

(^

)^

f^

x

i (^

)^

x

i^

2

x

i

(^

)^

f^

(^1) (

)^

x

i (^

)^

x

i^

2 +^

x

i

(^

-^

f^

(^2) (

)^

x

i (^

x

i^

2

x

i

(^

-^

f^

(^3) (

)^

x

i (^

)^

O x

i^

2

x

i

(^

f^

i^

2

f^

i^

h f

i

(^1) (

)^

h

2

f^

(^2) ( (^) i

)^

h

3

f^

(^3) ( (^) i

)^

O h

(^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

Approximating Derivatives by Linearly Combining Functional Values at Nodes Forward first order accurate approximation to the first derivative • Consider 2 nodes,

and

• Combine the difference of the functional values at these two nodes

i^

i^

i^

i+

fi

fi+

f^

i^

1

f^

i

f^

i^

h f

i

(^1) ( )

h

-^

f^

(^2) ( (^) i

)^

h

-^

f^

(^3) ( (^) i

)^

O h

(^

f^

i

h f

i

(^1) ( )

f^

i^

1

f^

i

h

-^

f^

(^2) ( (^) i

)

h

-^

f^

(^3) ( (^) i

)

O h

(^

f^

(^1) ( (^) i )^

f^

i^

1

f^

i

  • h

h --- 2

f

i

(^2) (

)^

h

-^

f^

(^3) ( (^) i

)

O h

(^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

• First derivative of

at node

is approximated as

where

• This is the first forward difference and the error is called first order in

(i.e.

• Notes:

• There is a clear dependence of the error on• The first forward difference approximation is

exact

for 1

st

degree polynomials

f^

i

f^

(^1) ( (^) i

)^

f^

i^

1 +

f^

i

  • h

----------------------

-^

E

E

h --- 2

f

i

(^2) (

)

h

E

O h

(^

x

i^

x

i+

=

x

+hi

fi

fi+

approximate slope f

i+

- f

i

h

actual slope f

i

h

f(x)

h

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

Central second order accurate approximation to the first derivative • Consider nodes

,^

and

and examine

• Central difference approximation to the first derivative is• Formula has an error which is

second order

in

i^

i^

i^

f^

i^

1

f^

i^

1

f^

i^

1

f^

i^

1

f^

i^

h f

i

(^1) (

)^

h

-^

f^

(^2) ( (^) i

)^

h

-^

f^

(^3) ( (^) i

)^

O h

(^

^

^

f^

i^

h f

i

(^1) (

)

h

-^

f^

(^2) ( (^) i

)^

h

-^

f^

(^3) ( (^) i

)

O h

(^

^

^

f^

i^

1

f^

i^

1

h f

i

(^1) (

)^

h

-^

f^

(^3) ( (^) i

)^

O h

(^

f^

(^1) ( (^) i

)^

f^

i^

1 +

f^

i^

1

  • 2 h

-^

E

h

E

h

f

i

(^3) (

)^

O h

(^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

• The smaller

, the smaller the error

• Error is obviously generally better for the central

formula than the forward or

backward

formulae!

• Expression is exact for 2nd degree polynomials due to the third derivative in the expres-

sion for

E

x

i-

fi-

fi+

approximate slope f

i+

- f

i-

2h

actual slope f

i

f

i^

i+

h

O h

(^

O h

(^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

Forward first order accurate approximation to the second derivative • Now consider nodes

,^

and

and the linear combination of functional values

• Forward difference approximation to second derivative• Error

first order

in

i^

i^

i^

f^

i^

2

f

i^

1

f^

i

f^

i^

2

f

i^

1

f^

i

f^

i^

h f

i

(^1) ( )

h

2

f^

(^2) ( (^) i )^

h

3

f^

(^3) ( (^) i

)^

O h

(^

^

^

=^2

f^

i^

h f

i

(^1) (

)^

h

-^

f^

(^2) ( (^) i

)^

h

3

f^

(^3) ( (^) i

)^

O h

(^

^

^

f^

i (^

f^

i^

2

f

i^

1

f^

i

h

2

f^

(^2) ( (^) i )^

h

3

f^

(^3) ( (^) i )

O h

(^

f^

(^2) ( (^) i

)^

f^

i^

2 +

f

i^

1 +

f^

i

+

h

2

-^

E

h E

h f

i

(^3) ( )

O h

(^

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

TABLE OF DIFFERENCE APPROXIMATIONS • First Derivative Approximations

• Forward difference approximations:

• Backward difference approximations:

f^

(^1) ( (^) i )^

f^

i^

1

f^

i

  • h

E

E

h f

i

(^2) (

)

f^

(^1) ( (^) i )^

f^

i^

2

f

i

1 +^

f

i

h

-^

E

E

h

2

f^

(^3) ( (^) i

)

f^

(^1) ( (^) i )^

f

i^

3

f

i

2

f

i^

1

f^

i

h

-^

E

E

h

3

f^

(^4) ( (^) i

)

f^

(^1) ( (^) i )^

f^

i^

f^

i^

1

h


-^

E

E

h f

i

(^2) (

)

f^

(^1) ( (^) i )^

f

i^

f

i^

1

f^

i^

2

h

-^

E

E

h

2

f^

(^3) ( (^) i )

f^

(^1) ( (^) i )^

f

i^

f

i^

1

f

i^

2

-^

f

i^

3

  • 6 h

-^

E

E

h

3

f^

(^4) ( (^) i )

CE 341/441 - Lecture 11 - Fall 2004

p. 11.

• Backward difference approximations:

• Central difference approximations:

• 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?

f^

(^2) ( (^) i )^

f^

i^

f

i^

1

f^

i^

2

h

2

E

E

h f

i

(^3) (

)

f^

(^2) ( (^) i )^

f

i^

f

i^

1

f

i^

2

-^

f^

i^

3

+^ h

2

-^

E

E

  • h

2

f^

(^4) ( (^) i )

f^

(^2) ( (^) i )^

f^

i^

1

f

i

f^

i^

1

h

2

-^

E

E

h

2

f^

(^4) ( (^) i

)

f^

(^2) ( (^) i )^

f^

i^

2

f

i

1 +^

f

i

f

i^

1

-^

f^

i^

2

h

2

-^

E

E

h

4

f^

(^6) ( (^) i

)