Determining an n for Numerical Integration

In summary, when estimating an integral using trapezoidal approximation, the error or uncertainty in the estimation can be found by using the formula: ##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 the interval [a,b], ##n## is the number of intervals, and ##T_n## is the trapezoidal approximation with n intervals. To achieve a desired degree of accuracy, M must be set to be less than or equal to the desired maximum value of uncertainty, and n can be solved for to give the appropriate number of intervals. The role of the second
  • #1
opus
Gold Member
717
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: 326
Physics news on Phys.org
  • #2
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
  • #3
I think they choose ##x = 1## because that will give the largest value for ##f''## by inspection.
 
  • Like
Likes opus
  • #4
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
  • #5
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##?
 
  • #6
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?
 
  • #7
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.
 
  • #8
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
  • #9
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.
 

1. What is numerical integration?

Numerical integration is a method used to approximate the definite integral of a function by dividing the interval into smaller subintervals and using numerical techniques to calculate the area under the curve.

2. Why is it important to determine the appropriate n for numerical integration?

The value of n, or the number of subintervals, directly affects the accuracy of the numerical integration. A smaller n may result in a less accurate approximation, while a larger n may require more computational resources.

3. How do you determine the appropriate value of n for numerical integration?

The appropriate value of n can be determined by using techniques such as the trapezoidal rule, Simpson's rule, or Gaussian quadrature. These methods involve calculating the area under the curve using different numbers of subintervals and comparing the results to find the most accurate approximation.

4. What factors can affect the choice of n for numerical integration?

The choice of n can be affected by the complexity of the function being integrated, the desired level of accuracy, and the available computational resources. Additionally, the presence of discontinuities or singularities in the function can also impact the choice of n.

5. Are there any limitations to using numerical integration?

Yes, there are limitations to using numerical integration. It is only an approximation and may not be exact. The accuracy of the approximation also depends on the choice of n and the function being integrated. Additionally, numerical integration may not be suitable for highly oscillatory or rapidly changing functions.

Similar threads

Replies
24
Views
2K
Replies
3
Views
2K
Replies
4
Views
758
  • Calculus and Beyond Homework Help
Replies
4
Views
706
Replies
3
Views
1K
Replies
1
Views
945
Replies
14
Views
2K
Replies
11
Views
2K
Back
Top