Numerical Integration Assignment
Due Thursday, April 18, 2002
Implement three additional numerical integration techniques in
the Integrate.java program:
- Adaptive Simpson
- Monte Carlo
Changes you need to make include:
- Add the three options to the menu method.
- Add calls to your methods that perform each option in the
- Add methods to perform Adaptive Simpson (you should break this
into two methods):
- The basic Adaptive Simpson method should have 4 parameters --
the endpoints of the interval that Adaptive Simpson is being applied
to, the tolerance (the maximum absolute error desired), and
the function number. This will be a recursive method. To provide
a trace showing the points where the integrand is sampled the
method should print out the end points (at the beginning of the method).
This method will also need to call the Simpson method that has
already been written.
- A method that is called from main -- it will need to read in
the starting endpoints and the tolerance then call the recursive
algorithm. It should print the final answer.
- Add a method to perform Monte Carlo integration. This method
must read in the number of points to be sampled in addition to
the endpoints of the interval of integration.
- Add a method to perform Romberg Integration. This method
should print out the triangular array of approximations (a skeleton
of this method will be handed out and is in the file
Use your program to answer the following questions:
- Do parts (b), (c), and (d) of Computer Problem 8.1 (page 878). For
part (c) you will use your Adaptive Simpson rather than a "library"
routine. In characterizing the error for part (b) -- Romberg --
compare the error as you go down a column versus going across rows.
Be sure to do all the things requested. The graph you are requested
to draw is similar to the example handed out.
- Use your Adaptive Simpson on the function f(x) =
(100/x2sin(10/x) on [1,3]. Compare your results to
those in the picture.
- Do parts (b), (c), and (d) for Computer Problem 8.2.
Hand In: A printout of your final program and your answers to
the questions. Email a copy of your program to