Python Are errors important in calculating integrals in Python?

AI Thread Summary
Calculating integrals using Simpson's Rule and the Trapezoidal Rule involves understanding the associated errors, which is crucial for ensuring accuracy in numerical methods. The discussion highlights that while the trapezoidal rule has a higher order, the midpoint method can yield better accuracy for certain functions. Estimating error is essential, particularly for functions that change rapidly, as this affects the choice of step size and method. The conversation clarifies the distinction between definite and indefinite integrals, emphasizing that the numerical techniques discussed are specifically for approximating definite integrals. Understanding these concepts is vital for achieving desired precision in computational physics applications.
Samuel Rodriguez
Messages
3
Reaction score
0
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.
 
Technology news on Phys.org
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
Oh I see. I was thinking of simple integrals ∫x2+ 2 dx lol. I wasn't thinking of harder integrals.
 
Samuel Rodriguez said:
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.
 
Mark44 said:
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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top