Mathematica Assignment 3 Worksheet
Document Sample


Mathematica Assignment 4 : Worksheet
Numerical Integration
Name: (Do this lab individually).
Open the Mathematica file and do the initial problems in the Mathematica notebook.
Then use the programs in the workbook to answer the questions on this worksheet.
2
1
Part I: 1. Estimate x dx using the various numerical methods and n = 4 subintervals.
1
Remember you will first need to ENTER the definition of the program and then you can use
the program.
Leftsum[1, 2, 4] =
Rightsum[1, 2, 4] =
Midpointsum[1, 2, 4] =
Trapezoidsum[1, 2, 4] =
Simpsonsum[1, 2, 4] =
1
4
2. Using pencil and paper, show that 1 x 2
dx
0
3. Use Mathematica to calculate to 10 decimal places (i.e. to 11 digits) with the command
N[ , 11] =
To help understand the accuracy of the various numerical methods, we will first numerically
approximate an integral whose value we know. Then we will approximate an integral whose
value we do not know and which we can not figure out using our analytic techniques (i.e.
using our various integral formulas). This later case is when numerical methods get used in
real life.
1
4
Part II: Estimate 1 x 2
dx using the various methods. Take n = 10, 100, 1000, 10000
0
and 100,000. Record your results in following tables similar to the one below for the Left
Endpoint Sum. Record your results to 10 decimal places (hence to 11 digits).
You will to change the definition of f(x) inside each of the programs and the value
need
which controls the number of decimal places. What are the values of a and b in this problem?
=
a. Method: Left Endpoint Sum
Number n of Number of decimal
subintervals Sum places that are correct.
10
100
1000
10,000
100,000
Warning: It may be that when you try n=100,000, Mathematica gets hung up doing the
calculation and does not finish. In that case, go to the Kernel menu and highlight the Abort
Evaluation. This will stop the calculation.
How quickly does the Left Endpoint Sum approach the true value of the integral as n
increases? By this, we mean:
Each time we increased the value of n by a factor of 10, the number of decimal places that
were correct increased (roughly) by ______________.
b. Method: Midpoint Sum
Number n of Number of decimal
subintervals Sum places that are correct.
10
100
1000
10,000
100,000
How quickly does the Midpoint Sum approach the true value of the integral as n increases?
Each time we increased the value of n by a factor of 10, the number of decimal places that
were correct increased (roughly) by ______________.
c. Method: Trapezoid Sum
Number n of Number of decimal places
subintervals Sum that are correct.
10
100
1000
10,000
100,000
How quickly does the Trapezoid Sum approach the true value of the integral as n increases?
Each time we increased the value of n by a factor of 10, the number of decimal places that
were correct increased (roughly) by ______________.
d. Method: Simpson’s Sum: For this, set the number of digits to 31 so you can more clearly
track how many places are correct.
Number n of Number of decimal
subintervals Sum (Record the sum to the number of places places that are correct.
correct plus 2 more places)
10
100
1000
10,000
100,000
How quickly does the Simpson’s Sum approach the true value of the integral as n increases?
Each time we increased the value of n by a factor of 10, the number of decimal places that
were correct increased (roughly) by ______________.
Conclusions: Which method is the most efficient for estimating an integral?
Which methods are the least efficient?
Which methods are of middling efficiency?
1
Part III: Estimate cos(x 2
)dx using the Left Endpoint, Midpoint, Trapezoid and
0
Simpson’s methods. This is an integral whose value we can not find by a formula. The only
way to find it is by numerical integration. Take n = 10, 100, 1000, 10000 and, if your
computer can handle it, 100,000. Make tables like above.
For each method, state as accurately as you can what the value of the integral is. In this final
answer, only include those decimal places that you are absolutely sure are correct!
As a start, here is the table for left endpoint sum.
a. Method: Left Endpoint Sum
Number n of Number of decimal
subintervals Sum places that are correct.
10
100
1000
10,000
100,000
Each time we increased the value of n by a factor of 10, the number of decimal places that
were correct increased (roughly) by ______________.
At the end of this investigation with the Left Endpoint sum, our best estimate for the value of
the integral (including only decimal places that we are sure are absolutely correct) is:
Get documents about "