Numerical Approximations for Calculus and Differential Equations I - Prof. J. Lega, Study notes of Differential Equations

An in-depth exploration of numerical approximations for definite integrals using various methods such as left rule, right rule, midpoint rule, trapezoid rule, and taylor polynomials. It also covers the concepts of overestimates and underestimates, discretization errors, and round-off errors. Additionally, it introduces numerical integration of ordinary differential equations using euler's method, modified euler's method, and heun's method.

Typology: Study notes

Pre 2010

Uploaded on 08/31/2009

koofers-user-sbm
koofers-user-sbm 🇺🇸

7 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Calculus and Differential Equations I
MATH 250 A
Numerical approximations
Numerical approximations Calculus and Differential Equations I
Numerical approximation of definite integrals
You should already be familiar with the left and right-hand
Riemann sums used in the definition of the definite integral:
Ib
a
f(x)dx = lim
n→∞
n1
i=0
f(xi)∆x= lim
n→∞
n
i=1
f(xi)∆x,
where x=(ba)/nand xi=a+ix.
The left and right rules respectively approximate the integral I
with LEFT(n)andRIGHT(n), where
LEFT(n)=
n1
i=0
f(xi)∆x,RIGHT(n)=
n
i=1
f(xi)∆x,
with xand xidefined as above.
Link to Geogebra
Numerical approximations Calculus and Differential Equations I
Numerical approximation of definite integrals (continued)
The midpoint rule consists in approximating the definite
integral by evaluating fat the midpoint between xiand xi+1:
MID(n)=
n1
i=0
fxi+xi+1
2x.
The trapezoid rule approximates the area under the graph of f
between xiand xi+1 with the area of the corresponding
trapezoid:
TRAP(n)=
n1
i=0 f(xi)+f(xi+1)
2x.
From the above formula, one can see that
TRAP(n)=1
2(LEFT(n)+RIGHT(n)) .
Numerical approximations Calculus and Differential Equations I
Overestimates and underestimates
1Assume that fis increasing between aand band that we
approximate I=b
af(x)dx with LEFT(n). Which of the
following statements is correct?
1LEFT(n) is an underestimate
2LEFT(n) is an overestimate
3LEFT(n)isexact
2If fis increasing on [a,b], then
LEFT(n)b
a
f(x)dx RIGHT(n).
3Similarly, if fis decreasing on [a,b], then
RIGHT(n)b
a
f(x)dx LEFT(n).
Numerical approximations Calculus and Differential Equations I
pf3
pf4
pf5

Partial preview of the text

Download Numerical Approximations for Calculus and Differential Equations I - Prof. J. Lega and more Study notes Differential Equations in PDF only on Docsity!

Calculus and Differential Equations I

MATH 250 ANumerical approximations Numerical approximations^ Calculus and Differential Equations I

Numerical approximation of definite integrals^ You should already be familiar with the left and right-handRiemann sums used in the definition of the definite integral:^ I^ ≡

∫^ b^ f^ (x)^ dx^ =a

n−^1 ∑ lim^ f^ (xi n→∞^ i= ) ∆x^ =^ lim n→∞

n∑^ f^ (x) ∆x,i^ i=

where ∆x^ = (

b^ −^ a)/n^ and

x=^ a^ +^ i^ ∆xi^

The left and right rules respectively approximate the integral

I

with LEFT(n) and RIGHT(

n), where n− LEFT(n) = (^1) ∑^ f^ (x) ∆x,^ i^ i=

RIGHT(n) =

n∑^ f^ (x) ∆x,i^ i=

with ∆x^ and^

xdefined as above.i^

Link to Geogebra Numerical approximations

Calculus and Differential Equations I

Numerical approximation of definite integrals (continued)^ The midpoint rule consists in approximating the definiteintegral by evaluating

f^ at the midpoint between

xand^ x:i^ i+ n− MID(n) = (^1 ∑x+^ xi^ i+1 f^2 i= )^ ∆x.

The trapezoid rule approximates the area under the graph of

f

between^ xandi^

xwith the area of the correspondingi+^ trapezoid:TRAP(

(^ n− (^1) ∑f^ (n) = i= x) +^ f^ (x)i^ i+1^2

)^ ∆x.

From the above formula, one can see thatTRAP(

(^1) n) = (LEFT( 2 n) + RIGHT(

n))^. Numerical approximations

Calculus and Differential Equations I

Overestimates and underestimates^1 Assume that

f^ is increasing between

a^ and^ b^ and that we approximate^ I

∫^ b = f^ (x)^ dxa^ with LEFT(n

). Which of the

following statements is correct?^1 LEFT(n) is an underestimate^2 LEFT(n) is an overestimate^3 LEFT(n) is exact 2 If^ f^ is increasing on [

a,^ b], then^ ∫^ b LEFT(n) ≤^ f^ (x)^ dxa

≤^ RIGHT(n)

3 Similarly, if

f^ is decreasing on [

a,^ b], then RIGHT(n)^ ≤

∫^ b^ f^ (x)^ dx^ ≤a

LEFT(n). Numerical approximations

Calculus and Differential Equations I

Overestimates and underestimates (continued)^ In order to ensure that TRAP(

n) is an overestimate, which of the following requirements do we need?^1 f^ is increasing^2 f^ is concave up^3 f^ is concave down^4 f^ is decreasingIf^ f^ is concave up on [

a,^ b], then^ ∫^ b MID(n) ≤^ f^ (x)^ dx^ a

≤^ TRAP(n). Similarly, if^ f^

is concave down on [

a,^ b], then ∫ TRAP(n) ≤ b^ f^ (x)^ dx^ ≤^ a

MID(n). Numerical approximations

Calculus and Differential Equations I

Example of application^ Assume that the function

f^ is positive, decreasing, and concave down on [

a,^ b]. Let^ I^ =

∫^ b^ f^ (x)^ dx. a Assume that the values of LEFT(10), RIGHT(10), TRAP(10),and MID(10) are, in random order, given by

0.^703 ,^0.^724 ,

0.^735 ,^0.^745

Use the above to assign a value to each of LEFT(10),RIGHT(10), TRAP(10), and MID(10).Then, indicate which of the statements below is correct:^1 0.^703 ≤^ I

≤^0.^7242 0. 724 ≤ I ≤^0.^7353 0. 735 ≤ I ≤^0.^745 Numerical approximations

Calculus and Differential Equations I

Approximation errors^ If we use a numerical method, say the left rule, to approximatea definite integral

I^ , we define the absolute error

E(n), asL E(n) =^ I^ −^ LEFT(L

n). One can show that

|E(n)|^ and^ |L

E(n)|^ are^ linear functions ofR^ 1 /n. Similarly,^ |ET

(n)|^ and^ |E M^ (n)|^ decrease quadratically as

n^ is

increased.This can be improved by using Simpson’s rule, given by^ SIMP

(^1) (n) = (2 MID( 3 n) + TRAP(n

))^.

One can show that the error

|E(n)|^ decreases like 1S^

(^4) /n.

Numerical approximations

Calculus and Differential Equations I

Numerical integration of ODEs

dy=^ g^ (x,^ y^ )dx^ The above differential equation may formally be integrated as^ y^ (

x^ +^ h)^ −^ y^ (x) =

∫^ x+h^ g^ (t,^ y^ (t x

))^ dt.

If we know^ y^ (

x), a numerical approximation of

y^ (x^ +^ h) may

thus be obtained by finding an estimate of the integral in theright-hand-side of the above equation.Euler’s method consists in assuming that

g^ (t,^ y^ (t)) is

constant on the interval [

x,^ x^ +^ h], and equal to

g^ (x,^ y^ (x)),

where^ x^ is the left end-point of the interval.We thus have

y^ (x^ +^ h)^ ^ y^

(x) +^ h g^ (x,^ y

(x)). Numerical approximations

Calculus and Differential Equations I

Taylor polynomials (continued)^ The Taylor polynomial of degree

n, centered at

x^ =^ a, of a

function^ f^ is given by P(x) =^ f^ (a) + (x^ −n

(x^ −′ a)f (a) + (^2) a)′′f^ (a) +^ · · · 2!

n(x − a)( + f^ n! n)(a).

Of course, the above assumes that

f^ has is at least

n^ times

differentiable near

a. In what follows, we assume that

f^ is

smooth, for simplicity.One can show that the error made by replacing

f^ by its Taylor

polynomial of degree

n^ is given by f^ (x) =^ P(x) +n

R(x),^ Rn

(x^ −^ a(x) = n n+1)(n+1)f^ (ξ) (n + 1)!^

where^ ξ^ ∈^ (a,

x).

Link to d’Arbeloff Taylor Polynomials software Numerical approximations

Calculus and Differential Equations I

Numerical approximation of definite integrals revisited^ ∫^ b^ f^ (x)^ dxa

∫^ n− 1 x∑i+1 =^ xi i= f^ (x)^ dx,^ xi^

=^ a^ +^ i∆x,^

b^ −^ a∆x = .n^

For the left rule, for each

x^ ∈^ [x,^ x], we havei^ i+ f^ (x) =^ f^ (x) + (i^

′x − x) f (ξ(xi )),^ ξ(x)^ ∈

(x,^ x).i^

From this formula, we see that if

′^ f is positive and bounded by M between

xand^ x, theni^ i+1^0 ≤^ f^ (x)^ −^

f^ (x)^ ≤^ M(x^ i^

−^ x),i^

which gives that LEFT is an underestimate and ∣∫^ xi+1∣∣^ f^ (x)^ dx∣^ xi

∣∣∣ − f (x) ∆xi ∣^ ∫^ xi+1≤^ M^ (x^ xi −x)^ dx^ =^ M^ i^

(^2) (∆x). 2

Numerical approximations

Calculus and Differential Equations I

Approximation errors^ For the midpoint rule, we have, with

x+^ xi^ i+1 m = 2

f^ (x) =^ f^ (m)+(

′m−x) f (m)+ 12 ′′(x^ −m)f^ ( 2

ξ(x)),^ ξ(

x)^ ∈^ (x,^ x).i^

We can check that^ ∫^ xi+1^ xi

(f^ (m) + (m^ −

)^ ′ x) f (m)dx^ =^ f^ (m) ∆x, ′′^ so that if f is positive and bounded by M between

xandi^

x, theni+1^0 ≤^ f^ (x

[) − f^ (m) + (

′m − x) f (m) ]^ M≤^ (x^ −^ m^2

which gives that MID is an underestimate and that the larger′′ |f^ |, the larger the error.^ Numerical approximations

Calculus and Differential Equations I

Approximation errors (continued)^ Finally, for the trapezoid rule, we have (by integration byparts)^ ∫^ xi+1^ xi

f^ (x)^ dx^ = [(x

xi+1 − m)f (x)] xi^ ∫^ xi+1−^ (x^ −^ xi

′m) f (x)^ dx.

We can use a Taylor expansion for

′ f (x) near^ x^ =^ m^ to see

′′^ that if f is positive between

xand^ x, then TRAP gives ani^ i+ overestimate.Moreover, the error over an interval of length ∆

x^ is bounded (^3) by M(∆x)/12, where M^ is the maximum of

′′ |f |^ over that

interval.For all of these methods, if the error on the integral between xand^ xis of order (∆i^ i+^

p+1x), then the error on the integral between^ a^ and

b^ is of order 1

p^ /n, where^ n^ is the number of

sub-intervals.^ Numerical approximations

Calculus and Differential Equations I

Numerical integration of ODEs revisited^ A numerical method is consistent if the local discretizationerror goes to zero as

h^ →^ 0. A numerical method is convergent if the global discretizationerror goes to zero as

h^ →^ 0. Typically, one uses Taylor expansions to decide whether anumerical method is consistent and convergent.A numerical method may also be unstable, in the sense that anumerical solution to

′^ y =^ λy^ with λ <^ 0 can display growth. These are topics typically discussed in an introductory courseon numerical analysis, such as MATH 475.Finally, one should keep in mind that a numerical method is amap of the form

y=^ G^ (yn+1^ n

,^ n), and that if

G^ is nonlinear,

chaos may be observed.

Link to Chaos on the Web Numerical approximations

Calculus and Differential Equations I