[Math] calculus midpoint rule Find N for guaranteed error

calculus

enter image description here

For part a i get that its asking to use the midpoint trap and simpsons rule

I dont understand how to solve part b. Do i have to plug in the error somewhere and solve for n? or do i want the answer to be less than 10^-4? Why is it mentioning the 4th derivative of the function as a hint?

some clarification on what the question is asking and/or a push in the right direction would really help me.

Best Answer

I will do it for midpoint rule and leave other for you. Denote $$ h= \frac{2-0}{N}=\frac{2}{4} = \frac12 $$ and $$ x_i = 0 + \frac12 (2i -1)h = \frac12(2i-1)\frac12, \quad i =1,2,3,4 $$ The sum for midpoint rule for given function is then $$ M_N = h\sum_{i=1}^N \cos(x_i^3) = \frac12 (\cos(\frac1{64}) + \cos(\frac{27}{64}) + \cos(\frac{125}{64}) + \cos(\frac{343}{64})) $$ Without derivation (via Taylor expansion) the formula to bound the midpoint rule error $E_M$ is $$ E_M \leq \frac{h^2(2-0)}{24}\Bigg| \frac{d^2}{dx^2}\cos(x^3) \Bigg| $$ It follows ($h=\frac{2}{N}$) $$ E_M \leq \frac{1}{6N^2} \Bigg| \frac{d}{dx}(-\sin(x^3)3x^2) \Bigg| = \frac{1}{6N^2} \Bigg| -\cos(x^3)9x^4 - \sin(x^3)6x \Bigg| $$ The absolute value of the second derivative reaches its maximum value $144.27$ at $x=2$ (checked by Mathematica). Your error is therefore bounded by $$ E_M \leq \frac{24.4}{N^2} \leq 10^{-4} $$ This translates to $$ N^2 \geq 244000 $$ or $$ N \geq \sqrt{244000} = 493.97 $$ Consider a bit of rounding error...your $N$ should be at least $494$.

You will need the approximation of fourth derivative when calculating error of the Simpson's rule.