# How to fastest approximate definite integrals

I know that a definite integral is a limit of Riemann sums. So if one wanted to estimate a definite integral (because one might not be able to find an antiderivative), then one can just take enough subintervals.

I have recently learnt that one can also write the function considered as a power series (Taylor series or Maclaurin series). Then it is easy to find an antiderivative power series that one can then use to estimate the definite integral.

My question is: Which of these two methods is in general fastest?

As an example I considered $f(x) = x^3\arctan(x)$ and the integral $$\int_0^{1/2} f(x) dx.$$ I get that $$\int_0^{1/2} f(x) dx = \sum_{n=0}^{\infty} (-1)^n\frac{(1/2)^{2n+5}}{(2n+1)(2n+5)}.$$ The first three terms alone give an estimate of $0.0059$.

Using three left rectangles, I get $0.1211$ and the real answer is $0.00591592$. It looks like it is faster to use the Taylor series approach. Is this in general true?

• Not sure many people know the answer, as definite integrals are computed numerically with well-established methods like Simpson, Romberg or Gaussian quadrature. – Yves Daoust Apr 20 '15 at 17:09
• en.wikipedia.org/wiki/Numerical_integration is a well established area of numerical analysis. I suggest you start there. – user_of_math Apr 20 '15 at 18:21

Taylor series don't always converge. The Taylor series method can be very good if the interval of integration is inside the radius of convergence of the series, otherwise it may not converge at all.

But as Yves Daoust mentioned, you should be comparing this to more sophisticated numerical methods, not to Riemann sums. In practice, Riemann sums are almost never used for numerical integration.

• Thanks. I only know calculus. So I was just wondering how the two methods above might be compared. I am not trying to actually compute anything, just curious. – John Doe Apr 20 '15 at 18:43

Take a look at the wiki page for Monte-Carlo Integration:

http://en.wikipedia.org/wiki/Monte_Carlo_integration

This is how mathematica and other systems approximate definite integrals.

And it's devilishly clever.

• Certainly not for 1D integrals, Monte-Carlo is way too inaccurate. – Yves Daoust Apr 20 '15 at 17:15
• @YvesDaoust What are you talking about? It is exactly used for one-dimensional integrals. You shouldn't neg somebody if you don't know what you are talking about. – Gregory Grant Apr 20 '15 at 17:18
• I feel sorry for you. en.wikipedia.org/wiki/… – Yves Daoust Apr 20 '15 at 17:22
• Mathematica's standard methods for 1D integrals do not use Monte Carlo. They use numerical techniques that are much more accurate for smooth functions. The reference you gave shows how to compute a Monte Carlo approximation in Mathematica and compare the result to a much more accurate value obtained without Monte Carlo. – Robert Israel Apr 20 '15 at 17:51
• @GregoryGrant: do take a course in numerical methods. – Yves Daoust Apr 20 '15 at 17:54