Trapezoidal rule for $\int_0^2 e^{2x} \sin^2(3x)\,dx$

Trying to study but am unsure what i am doing/do not think I'm doing this correctly if someone can please help.

The question is:

Determine the values of $n$ and $h$ required to approximate $\int_0^2 e^{2x} \sin^2(3x)\,dx$ to within $10^{-4}$ using Composite Trapezoidal rule'

What i've done is: $$\frac{b-a}{2}[f(x_0)+f(x_1)]=\frac{2}{2} [f(0)+f(2)]\ =\frac{2}{2} [0+4.26264] = 4.262642$$

Now i know i haven't answered the question/found $n$ or $h$ but I don't have worked solutions to this question so i was just hoping for some guidance and explanation to what I'm doing wrong. (the question then asked to do the same thing but with Simpson's Rule, but i don't know how to do that either).

• You have up to now not employed the "composite" in "composite trapezoidal method". Do some experiments with the numbers of sub-intervals. Jun 1 '17 at 8:01

The error of trapezoidal rule for the integral $$\int_a^b f(x)dx$$ is $$\epsilon \approx \frac{h^2}{12}\left[f'(a)-f'(b)\right]=\frac{1}{12}\frac{(b-a)^2}{n^2}\left[f'(a)-f'(b)\right]$$
• Find $h$ first. Jun 1 '17 at 4:45
• if $h = \frac{b-a}{n}$ wouldn't I need to know $n$ to find $h$? Jun 1 '17 at 4:47
• Find $h$ by the error formula first. Jun 1 '17 at 4:52