MATH 2414-Handout 1 Spring 2014

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

MATH 2414.

0003 Spring 2014


Simpson’s Rule and Integration of Non-Elementary Functions
Recall that Simpson’s rule for approximate/numerical integration involves approximating the
integrand f ( x ) locally by interpolating parabolas (See the figure below).

The method consists of sub-dividing the interval of integration [ a , b ] into an even number of sub
b−a
intervals of the form the form [ x i−1 , x i ] of equal length ∆ x= where n is an even whole
n
number. Requiring that the interpolating parabolas in each interval of the form [ x i−2 , x i ] pass
through the points ( x i−2 , f ( x i−2 ) ) , ( xi−1 , f ( x i−1) ), and ( x i , f ( x i ) ) leads to the approximation

∫ f ( x ) dx ≈ S n ≡ ( ∆3x ) [ f ( x 0 ) + 4 f ( x 1 ) +2 f ( x 2¿) +4 f ( x 3 ) +⋯+ 2 f ( x n−2 ) ¿


a

Though one of the central goals of the course is to learn techniques for evaluating integrals by
means of antiderivatives, there will always be continuous functions whose antiderivatives are not
elementary functions, i.e., they cannot be expressed in closed form using the elementary
functions we have studied so far. An important example of a continuous function whose
antiderivative is not an elementary function is the standard normal curve from probability and
statistical theory
1 ¿¿
f ( x )= e .
√2 π
Numerous practical problems in probability and statistics can be solve by finding areas under this
curve over certain intervals, that is, by computing definite integrals of this function over limits
determined by the particular problems being solved.

Numerical integration is a viable option whenever the function you wish to integrate over
definite limits does not have an elementary antiderivative. As an example we consider the
function discussed above, the standard normal curve. To perform integration by Simpson’s rule
we can make efficient use of spreadsheets like Excel. For the standard normal curve the
tabulated value of the integral from 0 to 1 is
1 1

∫ f ( x ) dx= √ 21 π ∫ e−x / 2 dx ≈ 0.3413 .


2

0 0

Using the excel worksheet entitled MATH 2414-handout 1 Spring 2014.xls on the learning web
perform numerical integration of the standard normal curve from 0 to 1 using Simpson’s rule
with n=10, by following the steps below.

1) For this exercise take the number of subdivision points to be n=10, giving a value for the
b−a 1−0 1
length of each subinterval of ∆ x= = = . This is tantamount to selecting 0 as
n 10 10
the first partition point and placing a new partition point at each subsequent tenth until
reaching 1. In column B of the worksheet you can see the partition points labled, x 0=0 ,
x 1=0.1000, x 2=0.2000, and so forth.
2) Column C of the excel worksheet is reserved for the function value at each of the
partition points. In row 2 click on the cell in column C and press the “=” key. This will
bring up the formula menu. To find the function value for x 0=0 we need to plug the
value 0 in for x in the standard normal curve expression. The value to be plugged in is
located in cell B2, and can be plugged into the function by typing the following sequence
after the “=” in cell C2:
(1/(SQRT(2*PI())))*(EXP(-((B2)^2)/2))

After keying this sequence after the “=” press enter to evaluate the expression. If you
have keyed it correctly the cell should have the value 0.39894.
3) You could fill in the function value for the remaining partition points manually by re-
keying the above sequence for each subsequent cell and replacing B2 by B3 for row 3,
B4 for row 4, and so on. An easier method would be to place your mouse cursor at the
bottom right-hand corner of cell number C2 until the cursor turn into a black plus. Hold
the left mouse button and drag the cursor down to the end of cell C12. Releasing the
mouse button now should fill in the rest of the column.
4) Column D is reserved for the coefficients applied to each of the function values in
column C. It is always the case that the coefficients for the first and last function value
are 1, so fill in the cells D2 and D12 with 1’s. The remaining coefficients are
palindromic and alternate between 4’s and 2’s according to the pattern
1 , 4 , 2 , 4 , 2 , 4 , 2 ⋯ 4 , 2, 4 ,1. Fill in the remaining cells in column D.
5) Column E is reserved for the product of the function value with its corresponding
Simpson’s coefficient. To fill in cell E2 click on the blank cell and press the “=” key.
After doing that key the following sequence:
C2*D2

This fills the cell with the value that is the product of the function value in C2 with the
Simpson’s coefficient in D2. Use the drag and fill method explained in step 3 to fill the
remaining cells in column E.
6) In cell F14 there is a reserved spot for the quantity S10, our approximate value for the
integral in question. This value is found by multiplying the sum of the entries in cells E2
∆ x 0.1 1
through E12 by the constant value = = . Do this by keying an “=” in cell F14,
3 3 3
and then keying the sequence below

(((B12-B2)/10)/3)*SUM(E2:E12)

7) How well does this approximation match with the tabulated value given above?

You might also like