Numerical Methods, MAT 350
Autumn 2001
Homework: Some Integration
Due Wednesday, October 24, 2001 in class
Many important functions can be defined in terms of integrals. In
this homework, you will write a subroutine to perform
numerical integration and use this routine to calculate a function.
Note that the first part of the assignment is due earlier.
Your first task is to write a subroutine that performs
numerical integration. The boys in the class will use the
Extended trapeziodal rule
and the girls will use the Extended Simpson rule.
- The subroutine should have the following arguments:
the name of the function to be integrated, the
limits of integration, and n, the number of points
where the function is to be evaluated.
- The integration subroutine should go in a separate file.
- Use comment statements to explain the important variables
used in the subroutine.
- Try out your integration routine on a simple function
like x2 to see if it works.
This part of the assignment is due Friday, October 12.
Students, as denoted by their initials, will look at different functions:
- RM, JF:
The Bessel function of the first kind J0(z);
alternatively, you can try J1(z).
One can write this function in terms of an integral from 0 to pi.
Bessel functions are used all over the place in science and engineering.
Suggested domain: [0,10].
J0(10)=-0.245935764451348335...
J1(10)=0.0434727461688614367...
- EW, JT:
The modified Bessel function of the first kind I0(z).
One can write this function in terms of an integral from 0 to pi.
Bessel functions are used all over the place in science and engineering.
Suggested domain: [0,3].
I0(3)=4.88079258586502409...
- SH, NG:
The Frensel Integral C(z).
Frensel Integrals are used in diffraction theory (optics).
Suggested domain: [0,3].
C(3)=0.605720789297685630...
- JO:
The error function erf(z). This function is
very important in the world of probability
and statistics.
Suggested domain: [0,3].
erf(3)=0.999977909503001415...
- MN:
The sine integral Si(z).
Suggested domain: [0,10].
Si(10)=1.658347594218874049...
For your function, you need to do the following:
- Find a definition of your function in terms of an integral.
The Geneva College library has:
- M. Abramowitz and I. Stegun,
Handbook of mathematical functions
- I. S. Gradshteyn and I. M. Ryzhik,
Table of integrals, series, and products
- Look up the behavior of your function in the limits z
goes to zero and z goes to infinity. Print out or
photocopy a graph of the function.
- Write a subroutine (in the same file as your main program), for
the function to be integrated.
For some of the functions, you will need to use a
global variable to specify the value of z in your
subroutine; in FORTRAN,
you would use a
COMMON
block statement.
- Evaluate the integral for various values of n
at the example point given above. How large must
n be to obtain an error of
1.0E-2
?
How large must
n be to obtain an error of 1.0E-5
?
How large must
n be to obtain an error of 1.0E-8
?
- We have discussed the error associated with
both integration techniques.
Do your results agree with this? Explain.
- Graph your function versus z; a suggested domain
is given above.
Use at least n=50 when calculating the necessary
integrals.