Determining an n for Numerical Integration

  • I
  • Thread starter opus
  • Start date
  • #1
opus
Gold Member
717
131

Main Question or Discussion Point

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

Answers and Replies

  • #2
104
35
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?
 
  • #3
11,346
4,818
I think they choose ##x = 1## because that will give the largest value for ##f''## by inspection.
 
  • #4
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
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).
 
  • #5
opus
Gold Member
717
131
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##?
 
  • #6
opus
Gold Member
717
131
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?
 
  • #7
opus
Gold Member
717
131
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.
 
  • #8
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,728
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)$$
 
  • #9
opus
Gold Member
717
131
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.
 

Related Threads for: Determining an n for Numerical Integration

Replies
5
Views
1K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
10
Views
5K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
2
Views
12K
Replies
11
Views
9K
Top