0% found this document useful (0 votes)
112 views5 pages

Computational Methods

Derivation of Error in trapezoidal rule and Simpson's rule and solving numerically improper integrals

Uploaded by

KarimMohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views5 pages

Computational Methods

Derivation of Error in trapezoidal rule and Simpson's rule and solving numerically improper integrals

Uploaded by

KarimMohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Numerical method for Improper Integrals

To solve an improper integral in the form of:

f ( x ) dx

We take the limit for the answer as the upper limit and the lower limit goes to
infinity
t

lim f ( x ) dx
t t

After that we should check if the integral converges or diverges, in case the
improper integral converges we get:
a

I = f ( x ) dx + f ( x ) dx+ f ( x ) dx
a

And we transform
1
A

f ( x ) dx= t12 f ( 1t ) dt AB> 0


A

1
B

I = f ( x ) dx+ f ( x ) dx+ f ( x ) dx

1/ A

A
1 / A

1/B

1 1
1 1
1 1
f
dt+ 2 f
dt+ 2 f
dt
2
t
t
t
t
1/B t
0 t

()

()

()

For Example:

sin ( x )
dx
x
3

let

I =

sin ( x )
sin ( x )
sin ( x )
dx+
dx +
dx
x
x
x
3
3

solve first term

sin ( x )
dx
x
1
3

sin

( 1t ) dt

Using extended midpoint rule, h=1/15

1
3

( 1t ) dt 1

sin

15

( )]

f ( t 0.3 ) + f t 7 + f t 1 + f ( t 0.1 ) +f t 1 =

( ) ( )
30

30

1
[0.63523.90151.67655.440229.6409 ] =
15

solve second term

sin ( x )
dx
x
3

Ignoring singularity at x = 0
Solving by (Abramowitz and Stegun 1972, p. 886) for Higher order rules n = 9, h =
2/3
3

sin ( x )
4h
dx=
989 f 7 +5888 f 5 928 f 1 +10496 f 1 4540 f 1 +10496 f 1928 f 5 +5888 f 7 + 989 f 3 =3.5
x
14175
3
3
3
3
3
3
3

Solve third term

1/ 3

sin ( x )
dx
x
0

sin

( 1t ) dt

Using extended midpoint rule, h=1/15

1/ 3

sin

( 1t ) dt 1

15

[( )

f t 1 + f ( t 0.1 ) + f t 1 +f t 7 + f ( t 0.3 ) =
30

( ) ( )
6

30

1
[ 29.64095.4402 ] =0.2 75295
15

First and third term are equal because function is odd function symmetric around xaxis

I =3.58142( 0.275295 )=3.03081

t =3.526

Error of Trapezoidal rule

Take a single interval and integrate by parts


x i+ 1

f ( x ) dx= f ( t + xi ) dt t=xx i
xi

f ( t+ x i ) dt=[ ( t+ a )f ( t+ xi ) ]0 ( t+ a ) f ' ( t+ x i ) dt
0

Integrate by parts one more time


h

[(

] (
h

( t+a )2
( t+ a )2
'
''
f
t
+
x
dt=
(
t+
a
)
f
t
+
x

+b
f
t+
x
+
( i) [
( i) ]0
( i ) 2 +b f ( t+ x i ) dt
2
0 0
0
h

[( ) ]

2
( h+ a )2
( t +a )2
f ( t + x i ) dt=( h+a ) f ( xi +1 )af ( x i ) 2 +b f ' ( x i+1 ) + a2 +b f ' ( x i ) + 2 +b f ' ' ( t + x i ) dt
0
0

[ ]

We choose the constants a, b so that they make the smallest error bound
2

h
h
a=
, b=
2
8

Thus
So, far
x i+ 1

f ( x ) dx=
xi

h
f ( x ) + f ( xi +1 ) ] +
2[ i
0

where this term

n1 h

E T =
i=0 0

f ' ' ( t + xi ) dt

h
f ( x ) + f ( x i+1 ) ] isthe area of trapezoid
2[ i

h 2
2
h2 ' '

f ( t + x i) dt
2
8

( )
t

h
2

( ) h
t

the error :

Assume f ' ' ( x ) has upper bound K

|(
|(

|ET|
0

|ET| nK
0

|
|

h 2
2
h2
(|f ' ' ( t + x 0 )|++|f ' ' ( t+ x n1 )|) dt
2
8

h 2
2
h2
nK h3
dt=
2
8
12

K ( ba )3
| ET|=
12 n2

h=

ba
n

Error of Simpsons rule


x2

f ( x ) dx
x0

We will expand the function around


x2

x2

f ( x ) dx=
x0

x0

x 1=

''

x0 + x2
2

using Taylor expansion

''

'' ' '


f ( x1 )
f ' ( x1 )
f ( )
4
f ( x 1) + f ( x1 ) ( xx 1 ) +
x x1 )2 +
xx 1) 3+
(
(
( xx 1 ) dx
2
6
24
'

x2

f ' ( x1 )
f '' ( x 1)
f ' ' ' ( x1 )
f '' ' ' ( )
2
3
f ( x ) dx= x f ( x 1 ) + 2 ( xx 1 ) + 6 ( xx 1 ) + 24 ( xx 1 )4 + 12 0 ( xx 1 )5
x
0

x2

x0

( x 2x 1 )
3
( x 2x 1 ) ( x0 x1 )
( x 2x 1 )
( x 2x 1 )
5
[ 5( x 0x 1 ) ]
f

'' ' '

( )

120
''
''
f ( x1 )
f ' ( x1 )
2
[ 2( x 0x 1 ) ]+
[ 3 ]+

6
24
f ' ( x1 )
f ( x 1 ) ( x 2x 0 ) +

[ 4( x 0x 1 ) ]+

x2

f ( x ) dx=
x0

x2

][

5 (4 )
h3 f ' ' ( x 1 ) h5 f ' ' ' ' ( )
h f () h
h3 f ( x 0 )2 f ( x1 ) + f ( x 2) h2 ( 4)
f
(
x
)
dx=
2
h
f
x
+
+
=
2
hf
x
+

f
(

)
+
= [ f ( x0 )+

( 1)
( 1) 3
3
60
12
60
3
h2
x
0

the error=

5 (4)

h f ( )
90

You might also like