Are errors important in calculating integrals in Python?

  • #1

Main Question or Discussion Point

I am reading Mark Newman's Computational Physics textbook. He goes over calculating integrals with Simpsons's Rule and the Trapezoidal Rule, and then he goes over calculating their errors. Why would I have to ever worry about the error of the integral?

He has the chapters online at his website:

http://www-personal.umich.edu/~mejn/cp/chapters.html

He begins to go over this in chapter 5 on page 150.
 

Answers and Replies

  • #2
333
47
Why wouldn't you worry about it? For example you can prove that the midpoint method is actually better (in the sense it's accurate to a higher order) than the trapezoid rule even through the order of the method itself is higher for the trapezoid method which would be somewhat counter-intuitive.

Furthermore when actually implementing a method you really need to estimate the error or you don't know if the result you get is accurate at all. Functions that change rapidly are much harder to integrate so you need a smaller step size (or perhaps a different method). Often you want the method to be accurate to a certain number of decimals for a specific problem.
 
  • Like
Likes Samuel Rodriguez
  • #3
Oh I see. I was thinking of simple integrals ∫x2+ 2 dx lol. I wasn't thinking of harder integrals.
 
  • #4
33,745
5,434
Oh I see. I was thinking of simple integrals ∫x2+ 2 dx lol. I wasn't thinking of harder integrals.
The material you're reading has to do with definite integrals, such as ##\int_1^3 x^2 + 2 dx##, not indefinite integrals.

There's a huge difference between finding a symbolic antiderivative (as in ##\int x^2 + 2 dx##), and using numerical techniques to estimate a definite integral. The techniques mentioned in this thread are used to approximate definite integrals.
 
  • #5
The material you're reading has to do with definite integrals, such as ##\int_1^3 x^2 + 2 dx##, not indefinite integrals.

There's a huge difference between finding a symbolic antiderivative (as in ##\int x^2 + 2 dx##), and using numerical techniques to estimate a definite integral. The techniques mentioned in this thread are used to approximate definite integrals.

I understand you. It makes more sense. Thank you.
 

Related Threads on Are errors important in calculating integrals in Python?

Replies
5
Views
897
  • Last Post
Replies
7
Views
882
  • Last Post
Replies
3
Views
2K
Replies
7
Views
713
  • Last Post
Replies
9
Views
3K
Replies
50
Views
2K
Replies
4
Views
2K
  • Last Post
Replies
8
Views
3K
Replies
5
Views
4K
Replies
21
Views
1K
Top