This project is to familiarize students with Matlab after they already know how to use the trapezoid rule without programming:
Student Programming Project: Trapezoid Rule Project
We have investigated integrals in two ways: by explicitly using antiderivatives and
by approximation using sum of rectangles. For example, we can calculate
110(3x-2)dx=3x-1-1|110=-3x|110=(-0.3)-(-3)=2.7
This integral is easy to calculate since the antiderivative of its integrand, -3/x,
can be found exactly. But what if we want to allow the upper limit to be infinity?
1(3x-2)dx
Also some important functions do not have explicit antiderivatives.
Consider this function, which is used in representing normal distributions:
p(x)=e-x2/2/(2 ).
We do not have the tools to calculate the explicit antiderivative for this function, so we must approximate its integral numerically.
We will use MatLab to calculate integrals numerically with the trapezoid rule which we developed in class. The code can be found in the BGL book.
1. Estimate using the trapezoid rule the area under the curve of
f(x)=3x-2
on the interval [1, 10] using 100 subintervals. You will have to modify “function” in the f.m file in order to do this. Then run it and put in the appropriate values for a, b and n.
2. Now calculate the approximate integrals for the b=xmax 100 and then 1000. Note: you may have to modify n in order to get good accuracy, so when you state your results, mention what n you used. You may want to think about what n gives you the same xabove.
3. Calculate the exact value of the integrals in #2 using antiderivatives. Compare 1-3. What do you think is the value of 1(3x-2)dx?
4. Estimate using the trapezoid rule the area under the curve of
p(x)=e-x2/2/(2 )
over the interval [-1, 1] using an appropriate number of subintervals (you choose n based on what gives you enough accuracy). Hint: e^x is actually exp(x) in matlab, is just pi, and the square root function is sqrt(x).
5. Now calculate the same integral over [-2,2] for the same number of subintervals. Then try 10 times as many intervals.
6. Repeat, but for [-5,5], then [-10,10]. Conjecture the exact value of this integral from (-infinity, infinity).
7. Write up a research report, with a title, results, and conclusions/discussion. Also discuss the accuracy of your results as well as comparing and contrasting results. Are the results what you expected or different? Include a copy of your modified function files as an appendix.
There will be two phases of research report
Phase I. Due Thursday 2/26. You must upload your document to canvas or submit a GoogleDoc url (make sure you change settings to share by link).
Phase II. You will be assigned 2 reports to read of peers and give feedback. Please review by Thursday 3/3.
Follow the peer review guidelines.
Your grade will be a combination of completion, effort in draft, insight and proper conclusions, (all assessed by the biodiversity lab rubric here) and peer review quality of comments you make for other people. No introduction or methods are required.