Undergrad Determining an n for Numerical Integration

Click For Summary
In numerical integration using the trapezoidal rule, the error is bounded by the formula involving the maximum absolute value of the second derivative, M, over the interval [a, b]. The second derivative's role is crucial as it indicates the function's concavity, which directly affects the accuracy of the approximation. To achieve a desired accuracy, one must determine M and solve for the number of intervals, n, needed to maintain the error within acceptable limits. The discussion also highlights confusion regarding the calculation of M and the necessity of using the absolute value, as it ensures the error estimate accounts for both overestimations and underestimations. Understanding these concepts is essential for effectively applying the trapezoidal rule in numerical integration.
opus
Gold Member
Messages
717
Reaction score
131
When estimating an integral using trapezoidal approximation, we can find the error or uncertainty in the estimation by:
##Error~in~T_n \leq \frac{M(b-a)^3}{12n^2}## where ##M## is the maximum value of the absolute value of f''(x) over [a,b], ##n## is the number of intervals, and ##T_n## is the trapezoidal approximation with n intervals.

If we want an estimation within a certain degree of accuracy, we find M, set in less than or equal to our desired maximum value of uncertainty, then solve for n. This will give us an n amount of intervals to use for the approximation to stay withing a specified range of error or uncertainty.

My question is two fold:
First, why is ##M## the absolute value of f''(x)? What is the role that the second derivative plays here and why absolute value?

Second, please see the attached image which is part of an example problem in my text. I don't know what they're doing when solving for the absolute value of f''(x). Clearly, the maximum would be 6e, as when we plug in 1 into the second derivative, this is what we get. But I don't know what they're doing to get this value. I am referring to the very bottom line of the attached image.
 

Attachments

  • Screen Shot 2019-01-24 at 11.00.21 AM.png
    Screen Shot 2019-01-24 at 11.00.21 AM.png
    13.7 KB · Views: 421
Physics news on Phys.org
So I hope I understood your problem correctly.

The error T in the result of a numerical calculation R should always be interpreted as this:

The result for the analytical solution S is with certainty 100% in the interval [R-T,R+T].

What you do is make a worst case analysis. In trapezoidal numerical integration, the errors come primarily from the local second derivative. So you look up in your function where the second derivative is largest, and then find that the final error will be smaller than the case where every trapezoid yields the worst case error. Is this helpful?
 
  • Like
Likes opus
I think they choose ##x = 1## because that will give the largest value for ##f''## by inspection.
 
  • Like
Likes opus
opus said:
When estimating an integral using trapezoidal approximation, we can find the error or uncertainty in the estimation by:
##Error~in~T_n \leq \frac{M(b-a)^3}{12n^2}## where ##M## is the maximum value of the absolute value of f''(x) over [a,b], ##n## is the number of intervals, and ##T_n## is the trapezoidal approximation with n intervals.

If we want an estimation within a certain degree of accuracy, we find M, set in less than or equal to our desired maximum value of uncertainty, then solve for n. This will give us an n amount of intervals to use for the approximation to stay withing a specified range of error or uncertainty.

My question is two fold:
First, why is ##M## the absolute value of f''(x)? What is the role that the second derivative plays here and why absolute value?

Second, please see the attached image which is part of an example problem in my text. I don't know what they're doing when solving for the absolute value of f''(x). Clearly, the maximum would be 6e, as when we plug in 1 into the second derivative, this is what we get. But I don't know what they're doing to get this value. I am referring to the very bottom line of the attached image.

Google is your friend. Do a search using keywords "trapezoidal rule error", and you will find articles that tell you all you want to know, and more.

Anyway, I do not agree with their calculation leading to ##|f''(x)| \leq 6##; I would say that ##|f''(x)| \leq 18,## because ##2 \times 3 \times e \leq 18.## So, I think you need to take ##M = 18## (or ##M = 6 e,## which is a bit less but harder to use and probably will not affect ##n## very much).
 
  • Like
Likes opus
Gigaz said:
So I hope I understood your problem correctly.

The error T in the result of a numerical calculation R should always be interpreted as this:

The result for the analytical solution S is with certainty 100% in the interval [R-T,R+T].

What you do is make a worst case analysis. In trapezoidal numerical integration, the errors come primarily from the local second derivative. So you look up in your function where the second derivative is largest, and then find that the final error will be smaller than the case where every trapezoid yields the worst case error. Is this helpful?
So to find the error of approximation with a problem like this, we need to graph it and see where in the interval that the second derivative is the largest (most concavity)? And this is where I have been confused in my research- we are using the trapezoids to "fill up" the area under neath the graph of ##f## Now depending on concavity of the graph of ##f##, that will determine if the approximation is an over estimate or under estimate in that interval. So why don't we just look at the graph of ##f## rather than the graph of ##f''##? Or do we look at the graph of ##f##, we are just concerned about ##f''## which is the concavity of ##f##?
 
jedishrfu said:
I think they choose ##x = 1## because that will give the largest value for ##f''## by inspection.
So then our errors are naturally going to be different for the intervals that we choose and depending on the interval, we can have either an under approximation or an over approximation?
 
Ray Vickson said:
Google is your friend. Do a search using keywords "trapezoidal rule error", and you will find articles that tell you all you want to know, and more.

Anyway, I do not agree with their calculation leading to ##|f''(x)| \leq 6##; I would say that ##|f''(x)| \leq 18,## because ##2 \times 3 \times e \leq 18.## So, I think you need to take ##M = 18## (or ##M = 6 e,## which is a bit less but harder to use and probably will not affect ##n## very much).
I've done the research but can't find an answer as to why we have an absolute value here.
 
opus said:
I've done the research but can't find an answer as to why we have an absolute value here.

The Wikipedia entry proves the formula
$$\text{error} = f''(\xi) \frac{(b-a)^3}{12 N^2}, $$
where ##f''(\xi) = \max_{x \in [a,b]} |f''(x)|.##

The article suppose the error measure to be ##> 0## because it measures an upper bound on the distance between the computed result and the true result. If you look more carefully into the proof you will realize that if
$$ m_1 = \min_{x \in [a,b]} f''(x) < 0$$ and $$m_2 = \max_{x \in [a,b]} f''(x) > 0$$ then the actual numerical error (positive or negative) satisfies
$$ m_1 (b-a)^3/(12 N^2 ) \leq \text{numerical error} \leq m_2 (b-a)^3/(12 N^2)$$ Therefore,
$$\text{error} \equiv |\text{numerical error}| \leq \max(|m_1|,|m_2|) (b-a)^3/(12N^2)\\ = \max_{x \in[a,b]} |f''(x)| (b-a)^3/(12 N^2)$$
 
  • Like
Likes opus
Ok thanks so much Ray, the key word distance there makes sense to me intuitively, but i went through that proof and its over my head currently. I just started Calculus 2 so the notation and techniques there were foreign and I didnt know what to even Google to clear up my confusion in the proof.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 24 ·
Replies
24
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
1
Views
5K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K