You are on page 1of 2

Oct 12, 2009.

Approximating functions. If f (x) is a complicated function of x can we approximate it by a


simpler function. The simpler functions are usually polynomials of low degree. Constants,
linear expression and quadratic expressions. You can use the approximations to evaluate
R1 1
integrals. For instance to calculate 0 1+x3 dx. The function f (x) has values

1 64 1 8 3 64 1
f (0) = 1, f ( ) = , f( ) = , f( ) = , f (1) =
4 65 2 9 4 91 2
Can we use this to evaluate the integral approximately?
Trapezoidal Rule; Approximate the function by a linear function in each of the inter-
vals [0, 41 ], [ 41 , 12 ], [ 21 , 43 ], [ 43 , 1].
If (a, f (a)), (b, f (b)) are two points the equation of the line joining them is

y f (a) f (b) f (a)


=
xa ba
or
f (b) f (a)
y = f (a) + (x a)
ba
and
b b
f (b) f (a)
Z Z
f (x)dx = ]f (a) + (x a) ]dx
a a ba
f (b) f (a) b
Z
= (b a)f (a) + (x a)dx
ba a
f (b) f (a) (x a)2 b
 
= (b a)f (a) + a
ba 2
f (b) f (a) (b a)2
= (b a)f (a) +
ba 2
f (b) f (a)
= (b a)[f (a) + ]
2
[f (a) + f (b)]
= (b a)
2
In our problem then

1 f (0) + f ( 41 ) f ( 41 ) + f ( 21 ) f ( 21 ) + f ( 43 ) f ( 43 ) + f (1)
I= [ + + + ]
4 2 2 2 2
1 1 1 3
= [f (0) + 2f ( ) + 2f ( ) + 2f ( ) + f (1)]
8 4 2 4
1 64 8 64 1
= [1 + 2( + + ) + ]
8 65 9 91 2
0.8317

1
Fit a Quadratic. Simpsons Rule.
Parabola through [(h, f (h)), (0, f (0)), (h, f (h))].

f (x) = ax2 + bx + c

c = f (0); ah2 + bh + c = f (h), ah2 bh + c = f (h)


Solve for b and c. Simultaneous equations, two unknowns.

f (h) 2f (0) + f (h) f (h) f (h)


a= 2
,b =
2h 4h
Z h
2ah3
I= [ax2 + bx + c] = + 2ch
h
3
h
= [f (h) 2f (0) + f (h)] + 2hf (0)
3
h
= [f (h) + 4f (0) + f (h)]
3
In our example
1 1 1 3 1 64 8 64 1
[f (0) + 4f ( ) + 2f ( ) + 4f ( ) + f (1)] = [1 + 4 + 2 + 4 + ]
12 4 2 4 12 65 9 91 2
0.8358

Actual value?
1 1 1 2x 1
Z
dx 2
= log(1 + x) log(1 x + x ) + arctan( )+c
1 + x3 3 6 3 3
1 1 1 1
= log 2 + 0 + [arctan arctan ]
3 3 3 3
1
= log 2 + = 0.8364
3 3 3

Homework. Calculate the following integrals from 0 to 1 by taking the values at points
spaced 0.1 apart by using trapezoidal rule and Simpsons rule. Compare the two values
with the actual values by integrating, using calculator or tables as necessary.
R1
1. 0
(2x + 3)dx
R1
2. 0
(1 + x2 )dx
R1
3. 0
(sin 10x)2 dx
R
4. ex dx

You might also like