# 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:

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.

STEMucator
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