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

• leo255
In summary, the Trapezoid Rule is a method used in calculus to approximate the area under a curve by dividing it into trapezoids and calculating their areas. It can be applied to functions such as e^cosx, which are commonly used in examples due to their simple derivative. The error in the Trapezoid Rule can be reduced by using more trapezoids or more advanced methods. However, it has limitations and may not be accurate for highly curved or discontinuous functions.

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

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

leo255 said:
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.

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.

leo255 said:
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.

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.

## 1. What is the Trapezoid Rule?

The Trapezoid Rule is a method used in calculus to approximate the area under a curve. It involves dividing the area into trapezoids and calculating the sum of their areas to estimate the total area.

## 2. How does the Trapezoid Rule apply to e^cosx?

In this case, the Trapezoid Rule can be used to approximate the area under the curve of the function e^cosx. By dividing the area into trapezoids and calculating their areas, we can estimate the total area under the curve.

## 3. Why is e^cosx used in this example?

e^cosx is often used in calculus examples because it is a relatively simple function with a known derivative. This makes it easier to demonstrate and explain the steps involved in using the Trapezoid Rule.

## 4. How is the error calculated when using the Trapezoid Rule?

The error in the Trapezoid Rule is calculated by finding the difference between the actual area under the curve and the estimated area using the Trapezoid Rule. This error can be reduced by using a larger number of trapezoids or by using more advanced numerical integration methods.

## 5. Are there any limitations to using the Trapezoid Rule?

Yes, there are limitations to using the Trapezoid Rule. It is not always accurate, especially for functions that are highly curved or have discontinuities. In these cases, more advanced numerical integration methods may be needed to get a more accurate result.