# Utilize the Trapezoid Rule for e^cosx, and find the error

## Homework Statement

Consider the definite integral, from 0 to 4, e^(cosx) dx

a) Compute the estimate for this integral using the trapezoid rule with n = 4.
b) Find a bound for the error in part a.
c) How large should n be to guarantee that the size of the error in using Tn is less than 0.0001

## Homework Equations

3. The Attempt at a Solution

A)[/B]

delta x = b-a/n = 4-0/4 = 1.

1 * [f(0) + 2f(1) + 2f(2) + 2f(3) + f(4)] =

To save you time/busy-work, double click the line below, right click, and search via google. It will calculate it for you, and show the exact answer.

e^(cos(0)) + 2 * e^(cos(1)) + 2 * e^(cos(2)) + 2 * e^(cos(3)) + e^(cos(4))

= 2.718 + 3.433 + 1.319 + 0.743 + 0.5220 = 8.733

Problem here: when I calculate this integral with my TI, I get a vastly different number (4.335). Anyway, onto B

B)

First derivative: -sin(x) e^(cos(x))
Second derivative: sin^2 (x) e^ (cos(x)) - cos(x) * e^(cos(x))

From here, I'm confused. I don't know exactly how to find "K". I know that it is the absolute value of the largest number possible of the 2nd derivative of the original function (3rd derivative for Simpsons Rule), and that it would be: k(b-a)^3 /12(n)^2.

I have read that you may want to make sin/cos functions equal to 1, since that is the highest value they can have, however doing that would yield:

1 * e^1 - 1 * e^1 =
e - e = 0

C) Haven't gotten to that point.

Last edited:

Related Calculus and Beyond Homework Help News on Phys.org
LCKurtz
Homework Helper
Gold Member

## Homework Statement

[/B]
Consider the definite integral, from 0 to 4, e^(cosx) dx

a) Compute the estimate for this integral using the trapezoid rule with n = 4.
b) Find a bound for the error in part a.
c) How large should n be to guarantee that the size of the error in using Tn is less than 0.0001

## The Attempt at a Solution

A)

delta x = b-a/n = 4-0/4 = 1.

1 * [f(0) + 2f(1) + 2f(2) + 2f(3) + f(4)] =

You want $\frac{\Delta x} 2 \ne 1$ in front of that sum.

LCKurtz
Homework Helper
Gold Member
First derivative: -sin(x) e^(cos(x))
Second derivative: sin^2 (x) e^ (cos(x)) - cos(x) * e^(cos(x))

From here, I'm confused. I don't know exactly how to find "K".

Try overestimating things using $|\sin x |\le 1$ and $|\cos x|\le 1$.

So you mean e + e? That would yield:

2e(4 - 0)^3 / 12 (4)^2 = Er <= 1.812

Doesn't seem like I got k right.

Zondrina
Homework Helper
In a latex form, you want:

$$\int_0^4 e^{cos(x)} \space dx$$

You answer for a) seems to be a bit off. The step size $h = 1$, so really you needed to compute:

$$I = \frac{1}{2} [f(0) + 2f(1) + 2f(2) + 2f(3) + f(4)]$$

Now for part b) you want to find a bound on the error. The approximate error is given by:

$$E_a = - \frac{(b-a)^3}{12n^2} \bar f''(\epsilon)$$

Where $\epsilon$ is somewhere in the interval. For practical purposes $\bar f''(\epsilon) = \frac{\int_a^b f''(x) \space dx}{b - a}$ is the average of the second derivative on the interval.

LCKurtz
Please use quotes so we know to whom you are replying and what equation you are referring to. I assume you are replying to my post. Also you haven't indicated what you are computing above so I will guess it is an estimate for the error with $n=4$. If so, yes, that is an upper bound for the error. Remember, you don't have to give the best possible upper bound, just an upper bound that works.