I posted this question in physics SE, as few suggested me to post it here: when I watch online lectures (usually of physics) most lecturers say that if we cant solve a integral exactly we can always numerically integrate it. (E.g. in central force problem the orbit where we find $\theta(r)$ or $r(\theta)$ is pretty difficult to compute and professor said that if needed we can always integrate it numerically if we cannot do it exactly)

So is it always possible to numerically integrate? Is there any example in physics where it not possible to integrate numerically or any integral which cannot be even integrated numerically? Is there any limitation of numerical integration?

  • 7
    $\begingroup$ Depends on how accurate you want it to be. $\endgroup$ Dec 22, 2020 at 15:32
  • 4
    $\begingroup$ The computational power you have at your disposal is one limiting factor. $\endgroup$ Dec 22, 2020 at 15:37
  • 2
    $\begingroup$ I would say that if you can calculate the value of the function, and there is an integral to be had (i.e., there is a well-defined meaning to what you are trying to integrate, and it is smooth and continuous, etc., etc.), then yes, you can always numerically integrate. The reason for this is that numeric integration is just the result of the function multiplied by $\Delta x$. So, if you can evaluate the function at each $x$ point, and it gives you a value which can be multiplied by $\Delta x$, then that is the numeric integration. $\endgroup$
    – johnnyb
    Dec 22, 2020 at 15:41

2 Answers 2


Suppose the integrand $f$ is Riemann integrable on $[a,b]$. Then the Riemann sums converge to $\int_a^b f(x)\;dx$. If you know a bound $M$ for $|f(x)|$ on $[a,b]$ you can rigorously prove a bound on the error for that approximation. That error bound goes to zero as the number of terms goes to infinity. So you CAN numerically integrate in this setting.

If you know $f$ is $n$ times differentiable, there are numerical integral calculations that converge more rapidly. For example, Simpson's rule.

But of course there are functions (according to mathematicians) that are not Riemann integrable. Do any of them come up in physics? You will have to ask physicists about that. (Mandelbrot reported that his early papers on fractals were routinely rejected by physics journals as "unphysical". But that is no longer the case today.)

For example, in quantum physics you deal with Hilbert spaces like $L^2$, where there are lots of non-Riemann-integrable functions.

Mathematical physicists are often writing down integrals with delta functions in there, but pretending they are actual functions. Will they try to compute these numerically?

Physicists write down divergent integrals like this: $$ \delta(x-\alpha) = \frac{1}{2\pi}\int_{-\infty}^{+\infty} e^{ip(x-\alpha)} \; dp . $$ Will they try to compute these numerically?

  • $\begingroup$ Although we do use a Hilbert space $\mathcal{H}$ such as $L^2$ in quantum mechanics, whether we admit or not we only use a dense subset $\phi\subset \mathcal{H}$ of our space on which operators are well-defined. In practice, this space $\phi$ looks like a Schwarz space $\mathcal{S}$. I would expect all functions in $\phi$ to be Riemann-integrable. $\endgroup$
    – Dispersion
    Dec 22, 2020 at 21:37
  • $\begingroup$ Let me also add that I suspect most physicists are aware of the fact that $\delta$ is best viewed as a distribution. The identity you wrote is used to manipulate $\delta$ because it is much more convenient than always working with its definition as a distribution, and will basically always lead to a correct answer in the manipulations physicists use. $\endgroup$
    – Dispersion
    Dec 22, 2020 at 22:04

The answer by @GEdgar considers numerical integration in exact arithmetic. This answer considers numerical integration using finite precision arithmetic.

So is it always possible to numerically integrate?

No. It is essentially impossible to evaluate an integral if the exact value is sufficiently close to zero. It is a question of conditioning. Finite sums that contain both negative and positive terms and sum to nearly zero are ill-conditioned. Our inability to compute the necessary function values with the required accuracy will destroy the accuracy of the computed approximation of the integral.

Is there any example in physics where it not possible to integrate numerically

Yes. The solution of the initial value problem \begin{align} y'(t) &= y(t) \\ y(0) &= 1 \end{align} will rapidly exceed the representational range of any finite number system.

or any integral which cannot be even integrated numerically?

Yes. Consider a polynomial $p$ that is zero for all machine numbers. Then $|p|$ is continuous and $$ \int_a^b |p(x)|dx > 0,$$ for any interval $[a,b]$, but the computed value of any Riemann sum or Gauss quadrature will be zero.

Is there any limitation of numerical integration?

Yes. You must provide the user with

  1. an approximation of the integral
  2. an error estimate, and
  3. an argument that explains why the error estimate is reliable.

If the truncation error obeys an asymptotic error expansion, then this is theoretically possible. However, if the order of accuracy is too high, then the asymptotic range is too short and it is essentially impossible to recognize that the error estimates are reliable.

  • 1
    $\begingroup$ +1, good answer. $\endgroup$
    – GEdgar
    Dec 23, 2020 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .