next up previous
Next: About this document ...

ESC 251 HW 19 Due: Oct. 23

1)
(6 pts) Write a program that will use the trapezoidal method to approximate the value of

\begin{displaymath}\int_{-1}^{3} x e^{-x^2} dx.\end{displaymath}

and determine the relative error in the approximation. Your program should read in the value of n. You will need to compute the exact value of the intergral, but let your program do most of the work. Obtain a formula for the value of the integral in terms of a and b, then have your program evaluate this formula. Don't manually compute the exact value, then assign
   exact = x.xxxxxxxxxd0

How large does n have to be in order for the relative error to be less than $\displaystyle {10^{-6}}?$ For this last question, use a trial and error approach. You don't have the find the exact value of n that satisfies the criteria, but you should get close (for example, if the exact value of n that meets the accuracy criteria is n = 250, then n = 300 would be ok, but n = 1000 is not).

2)
(6 pts) Repeat Problem 1, but this time, use the integral

\begin{displaymath}\int_{-1}^{3} x \sin\left( \frac{29 x}{2} \right) dx.\end{displaymath}

Explain any differences in the value of n you find here compared to the value of n from Problem 1.
3)
(2 pts) Can you use the trapezoidal rule to evaluate

\begin{displaymath}\int_0^2 \frac{1}{x-1}?\end{displaymath}

Explain why or why not.




next up previous
Next: About this document ...
2017-10-20