1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Utilize the Trapezoid Rule for e^cosx, and find the error

  1. Dec 13, 2014 #1
    1. The problem statement, all variables and given/known data

    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

    2. Relevant equations

    3. The attempt at a solution


    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


    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: Dec 13, 2014
  2. jcsd
  3. Dec 13, 2014 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    You want ##\frac{\Delta x} 2 \ne 1## in front of that sum.
  4. Dec 13, 2014 #3


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Try overestimating things using ##|\sin x |\le 1## and ##|\cos x|\le 1##.
  5. Dec 13, 2014 #4
    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.
  6. Dec 14, 2014 #5


    User Avatar
    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.
  7. Dec 14, 2014 #6


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted