Numerical Analysis: Composite Trapezoidal Sum Rule

AI Thread Summary
The discussion focuses on using the composite trapezoidal sum rule to evaluate the integral of (exp(x)-1)/x from 0 to 1, with a required approximation error of less than 10e-5. Participants clarify the calculation of the second derivative f''(x) and its behavior near x=0, correcting an earlier miscalculation. The maximum value of f''(x) is determined to be at the right endpoint of the interval, x=1, leading to the conclusion that the step size h should be approximately 0.0083568657. The number of intervals needed for the calculation is estimated to be around 120. The discussion emphasizes the importance of correctly evaluating f''(x) to ensure accurate error estimation in the trapezoidal rule.
aznkid310
Messages
106
Reaction score
1

Homework Statement



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
10e-5.
Carry out your calculation with at least 10 decimal significant figures.
Note: the exact answer rounds to
1:31790215145440389486:

Homework 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?

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.
 
Physics news on Phys.org
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.
 
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?
 
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?

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 interest [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]?
 
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:
As I said, I believe you have an error in your expression for f''(x). I came up with the following:

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

with

q(x) = x^2-2x+2

This would yield f''(1) = e-2 = 0.71828...

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

n \ge \sqrt{\frac{{(b-a)}^3}{12 \cdot \epsilon} \cdot f''(\zeta)}
 

Similar threads

Back
Top