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: Numerical Analysis: Composite Trapezoidal Sum Rule

  1. May 27, 2009 #1
    1. The problem statement, all variables and given/known data

    Use the composite trapezoidal sum rule to evaluate

    I = integral from 0 to 1 of: (exp(x)-1)/x

    At x = 0 the integrand evaluates to 1.
    Select the step size h in order to guarantee an approximation error less than
    Carry out your calculation with at least 10 decimal significant figures.
    Note: the exact answer rounds to

    2. Relevant equations

    I know that i need to find the max of f''(x), but it goes to infinity as x goes to zero. How do i find this max value?

    3. The attempt at a solution

    Using the Trapezoidal Sum rule with n=1, the error using the Newton Cotes Method is: (10e-5)=(1/12)*f''(x)*h^2

    So h = sqrt((12*10e-5)/f''(x))

    f''(x) = ((x^2 -2x+2)*exp(x)-1)/(x^3)

    I tried L'Hopitals rule, but that gave me 1/3 as x goes to zero, which is incorrect.
  2. jcsd
  3. May 28, 2009 #2
    Check you L'Hopitals evaluation again.

    f''(x) does not go to infinity as x approaches zero.

    Check your f''(x) expression - your "-1" in expression for f''(x) should be "-2" (but this does not effect your L'Hopitals evaluation, but it's incorrect)

    Another way you can look at this is by looking at the Taylor Series expansion of exp(x) at x=0. Plug that into the expression for f(x) and then take derivatives. Should get the same answer, f''(0) = 1/3.
  4. May 28, 2009 #3
    Trying the Taylor Series:

    f = (exp(x)-1)/x = sum (n=0 to infinity) (x^n)/(n+1)!

    f'' =[n(n-1)x^(n-2)]/(n+1)!

    How do I evaluate this to find the max value?
  5. May 29, 2009 #4
    You don't (directly). It was presented to allow you to evaluate f'' at x=0.

    However, if you can show that f'' is positive throughout the interval and uniformly increasing in the interval of intrest [0,1], then you know the max of f'' is at the right domain endpoint (x=1). Or, if it is positive throughout the interval and uniformly decreasing, then you know the max of f'' is at the left domain endpoint (x=0).

    Now, take another look at that series expansion and what can you say about f''(x) in the interval [0,1]?
  6. May 29, 2009 #5
    well, expanding the series out, it appears that it is indeed positive throughout the interval and uniformly increasing, so x_max =1.
    Then f''(x)_max = f''(1) = ((1^2-2+2)*exp(1)-1)/(1^3) = 1.718281828 ?

    Thus, h = 0.0083568657
    1/h = 119.66 ~120
    So the # of intervals N = 120? (ie 0 to 0.0083333333, 0.008333333 to 0.0166666667... all the way to 1?)

    Then, using the composite sum rule,

    (h/2)*(f0 +f1 + f1 + f2 + f2 + f3 + f3 +f4...+f120)?

    That does not seem correct, as doing this by hand would take a long time
    Last edited: May 29, 2009
  7. Jun 1, 2009 #6
    As I said, I believe you have an error in your expression for f''(x). I came up with the following:

    [tex]f''(x) = \frac{(q(x) \cdot e^x-2)}{x^3}[/tex]


    [tex]q(x) = x^2-2x+2[/tex]

    This would yield [itex]f''(1) = e-2[/itex] = 0.71828...

    Hence, I compute the minimum required n = 25 via the expression below where I've taken [itex]\epsilon[/itex] = 10E-5 = [itex]10^{-4}[/itex] and [itex]\zeta = 1[/itex].

    [tex]n \ge \sqrt{\frac{{(b-a)}^3}{12 \cdot \epsilon} \cdot f''(\zeta)}[/tex]
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook