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

Review of Numerical Methods-Numerical Methods in Engineering-review2-Civil Engineering and Geological Sciences, Study notes of Numerical Methods in Engineering

Review of Numerical Methods, Numerical Differentiation, Errors, Partial Differentiation, Numerical Integration, Newton Cotes, Closed Formulae, Open Formulae, Gauss Legendre, Integration Formulae, Extended Integration Methods, Romberg Integration

Typology: Study notes

2011/2012

Uploaded on 02/20/2012

damyen
damyen 🇺🇸

4.4

(27)

274 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CE 341/441 - Review 2 - Fall 2004
p. R2.1
REVIEW NO. 2
NUMERICAL DIFFERENTIATION
Find a discrete approximation to differentiation
Use numerical differentiation to solve o.d.e.s and p.d.e.’s on a computer
Recall that a computer doesn’t do differential/integral mathematics and only deals
with discrete functional values
Generic Method to Derive a Difference Formula:
where
, , = functional values at nodes
, , = coefficients of the formula being derived
when nodes are used (or better for some central approximations)
fip() Eaαfαaβfβaλfλ
++
hp
--------------------------------------------------------------=
fαfβfλ
,
aαaβaλ
,
EOh()
N
=pN+
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Review of Numerical Methods-Numerical Methods in Engineering-review2-Civil Engineering and Geological Sciences and more Study notes Numerical Methods in Engineering in PDF only on Docsity!

CE 341/441 - Review 2 - Fall 2004

p. R2.

REVIEW NO. 2NUMERICAL DIFFERENTIATION • Find a

discrete

approximation to differentiation

  • Use numerical differentiation to solve o.d.e.’s and p.d.e.’s on a computer
    • Recall that a computer doesn’t do differential/integral mathematics and only deals

with discrete functional values

Generic Method to Derive a Difference Formula:

where

= functional values at nodes

= coefficients of the formula being derived

when

nodes are used (or better for some central approximations)

f

i

p (

)

E

a

α

f

α

a

β

f

β

a

λ

f

λ

h

p

f

α

f

β

f

λ

a

α

a

β

a

λ

E

O h

N

p

N

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • Procedure:
    • Substitute Taylor Series expansions for

etc. about node

i

  • Rearrange equations such that coefficients multiply equal order derivatives at node

i

and generate algebraic equations by setting coefficients of

equal to 1 and the

other coefficients equal to zero

  • Solve for

etc.

Numerical Differentiation Formulae Using Interpolating Polynomials: • Use at least

nodes with the interpolation formula to establish an approximation to

the

p

th

derivative

  • Any interpolating technique/formula can be used• The numerical differencing formula is simply the differentiated interpolating polyno-

mial evaluated at one of the nodes used for interpolation

  • The error can be computed based on the error of the interpolating formula

f

α

f

β

f

i

p (

)

p

N

a

α

a

β

p

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • Error can be derived by
    • Applying Taylor series expansions to the terms in the differentiation formula• Differentiating the error in the interpolation function (assuming that this error is

expressed as a series and does not depend on

  • Higher order accuracy leads to better answers for larger

(presumably less work for

computer for a given level of accuracy)

  • However, higher order accuracy is not

always

better

  • Recall that for interpolation, piecewise linear was sometimes better than high order

interpolation

  • The same holds true for differentiation. It depends on the function• Also there are trade-offs in order of accuracy versus actual implementation cost on a

computer

ξ

h

CE 341/441 - Review 2 - Fall 2004

p. R2.

INTRODUCTION TO O.D.E.’s AND P.D.E.’SPartial Differentiation • Simply apply numerical differentiation formulae relative to the independent variable/

direction in which you are differentiating while holding indices associated with all otherindependent variables/directions constant.

Solving Single Equation O.D.E. I.V.P.’s • Solve

with a specified i.c.

  • Apply the Euler method by approximating the d.e. at

and applying a forward

difference approximation for the first derivative

  • Simply advance from one time level to the next by substituting known values

into

the right hand side and solving for

“time marching”

dy ----- dt

f

y t

y t

o

(

y

o

t

t

j

y

j

1

y

j

t

f

y

j

t

j

,

y

j

1 +

y

j

t f

y

j

t

j

,

y

j

t

j

,

y

j

1

CE 341/441 - Review 2 - Fall 2004

p. R2.

Solutions to P.D.E.’s • Space-time dependent p.d.e.’s are solved by defining a space-time grid of discrete nodes^ INSERT FIGURE NO. 68 • Discrete solutions are advanced in time by writing a sufficient number of algebraic

equations to allow the solution of all unknowns at a given time level

“time marching”

  • Solution is found at a specific time level prior to advancing to the next time level• Finite difference approximations are used to discretize the p.d.e.’s at either the

known or unknown time levels.

t

j+

j

j-

2 1

j=

(i,j)

i=

1

2

i-

i

i+

n-

n

i=n+

x

t

x

known valuesunknown values

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • Time discretizations for first time derivatives
    • Explicit: approximate the time derivative at the known time level j using a first order

forward approximation in time and evaluate all spatial derivatives at the known timelevel j

  • Implicit: approximate the time derivative at the unknown time level

using a

backward approximation in time and evaluate all spatial derivatives at the unknowntime level

  • Crank-Nicolson: approximate the time derivative at an intermediate time level

using a second order central approximation in time and evaluate the spatial

derivatives at the intermediate time level

(applying linear interpolation to

express the intermediate node values at

in terms of full node values at

and

  • Spatial differentiation is typically implemented using central finite difference approxi-

mations

  • Explicit methods do not lead to systems of simultaneous equations since there is no

coupling in the discrete equations between nodes at the unknown time level.

  • Implicit and Crank-Nicolson methods do lead to systems of simultaneous equations

since there is coupling in the discrete equations between nodes at the unknown timelevel.

j

j

j

j

j

j

j

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • Steps to derive integration formulae
    • Define a sub-interval• Define interpolation/integration points over the sub-interval as well as the interpola-

tion function type (and order)

(e.g. Lagrange or Hermite)

or

  • Integrate the approximating interpolating function over the sub-interval• Now sum up integrals over all sub-intervals to develop the “extended formulae”

Newton Cotes Closed Formulae • Derived by using equispaced interpolation points and Lagrange interpolation• Integration points are always at the end points of the sub-interval

  • Trapezoidal Rule and Simpson’s

Rule

Newton Cotes Open Formulae • Same as the closed formulae except that the sub-interval now extends beyond interpola-

tion (or integration) points

g x

f

i

V

i

x (

i^

0

N =

g x

f

i

α

i^

x (

i^

0

N =

f

i

(^1) ( (^)

)

i

β

i^

x (

i^

0 N =

CE 341/441 - Review 2 - Fall 2004

p. R2.

Gauss-Legendre Integration Formulae • Derived by using non-equispaced interpolation points and Hermite interpolation• Specifically the integration points are selected such that the integrals of the

func-

tions (associated with the derivative terms) are equal to zero.

  • Thus • Now we select the integration points

such that

β

i^

x (

I

g x

x d

1

+1^ ∫ –

g x

α

i^

x (

f

i

i

0

N =

β

i^

x (

f

i

(^1) ( (^)

)

i^

0

N =

I

f

i

α

i

x (

x d

1

+1^ ∫ –

i

0 N =

f

i

(^1) ( (^)

)

β

i^

x (

x d

1

+1^ ∫ –

i^

0 N =

x

i

β

i^

x (

x d

1

+1^ ∫ –

CE 341/441 - Review 2 - Fall 2004

p. R2.

Methods for Evaluating the Accuracy of Integration Methods For a Sub-interval Method 1: Develop Taylor Series expansions for f(x) and the functional values at thenodes • Equation for Simpson’s 1/3 rule

where

= the exact integral

= the integration formula

INSERT FIGURE NO. 110

E

f

x (

x

h --- 3

d

2 0

h

f

o

f

^1

f

^2

f

x (

x d

0 2

h

∫ h --- 3

f

o

f

^1

f

^2

x

0

=

x

f

0

f

1

f

2

x

1

=h

x

2

=2h

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • Develop Taylor Series expansions for

and

about the midpoint of the

interval

  • Substitute in and integrate Method 2: Use error terms from the interpolating function • Apply the error in the interpolation function in series form (using the first few terms)•

DO NOT

use

based on evaluations of the last derivative at

where

is a point in

the interval since

f

x (

f

o

f

^1

f

^2

x

1

h

e x

ξ

ξ

ξ

ξ

x (

e x

f

x (

g x

E

f

x (

x

g x

x d ∫ – d ∫ = E

e x

x d

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • However

  • We note that • Substituting

remains constant no matter what sub-interval spacing

you choose

remains approximately constant over the interval

no matter what sub-

interval

you choose.

N

b

a

  • h

h

b

a

  • N

E

C b

a

h

n

1

1 --- N

f

m (

)

x

i

(

i^

1

N =

1 --- N

f

m (

)

x

i

(

i^

1

N =

f

m (

)

x

i

(

E

C b

a

h

n

1

f

m (

)

x

i

b

a

h

f

m (

)

x

i

(

a b

[

]

h

CE 341/441 - Review 2 - Fall 2004

p. R2.

INSERT FIGURE NO. 112

log E

log h

1

h

n- n-

CE 341/441 - Review 2 - Fall 2004

p. R2.

  • Evaluate the integral using two or more spacings. This allows us to evaluate

etc.

  • Evaluate

with

with

  • Solve for• Improve accuracy by two orders
    • Evaluate
  • solve for

etc.

  • Improve accuracy by four orders!

I C D

˜ I

h

h

˜ I

2

h

h

I C

˜ I

h

˜ I

2

h

˜ I

4

h

I C D