Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Today in Calculus class I was bored so I decided to try and approximate $\pi$ by evaluating $ \left( \displaystyle \int_{-a}^a e^{-x^2} dx \right)^2$ on my calculator for larger and larger values of $a$.

However, in doing so, I noticed something peculiar. When I plugged in $a = 100$ it gave me a value of approximately $\pi$, as expected. However, when I plugged in $a = 1000$ I got an answer of about $2.7 \times 10^{-7}$. In fact, I was able to narrow it down to figure out that $a = 892.26$ and below (with reasonable assumption) gave me a correct value while $a = 892.27$ and above (with reasonable assumption) gave me some very small value like I found with $a = 1000$

What's going on here?

edit: I realize that this is a problem with the calculator's integration method. I am aware that larger values of $a$ should converge closer to $\pi$.

share|cite|improve this question
Don't know, so this isn't an answer, but sure does look like a bug. For abs(a) big enough, the calculator ought to just approximate it as + or - infinity, and use the asymptotic values of the integrated gaussian, related to the well-known "erf" function. – DarenW Apr 8 '14 at 23:06
I tried this on my TI-84 plus and while I got a different value, 7.36107732x$10^{-14}$, the value is obviously not $\Pi$. This is a very interesting bug. – TheBluegrassMathematician Apr 8 '14 at 23:24
Related discussion. – user127096 Apr 13 '14 at 22:22

First, it doesn't recognize your input as the error function, but just as a function to be integrated numerically. When it does so, probably what is happening is that the calculator starts by evaluating the integrand at a series of points between the upper and lower limits of integration, using something like the trapezoid rule to approximate the integral. Then it cuts the interval in half and computes it again. If they agree (closely enough) it believes it has converged and reports the result. If they disagree, it keeps working on smaller and smaller pieces (maybe changing the spacing to put lots of points where the function is changing rapidly) until it converges. When the interval becomes long enough, the spacing between the points gets wide enough that it misses the hump around $x=0$ completely, which is why it reports such a small number. You might find that if you set $a$ even larger, it returns exactly zero because the value of the integrand is so small at all the points it samples.

share|cite|improve this answer
The TI doesn't really know how to do integrals exactly, but instead probably uses this approach. You can try doing $\int_0^1\text{rand}\ dx$. It will spit out different values ~$0.5$. Sometimes it will take a while to think it converged to a value, and sometimes it will determine that it never converges. – user137794 Apr 8 '14 at 23:33
Search results suggest that TI-84+ uses Gauss-Kronrod quadrature, but I could not find the details such as the number of nodes. – user127096 Apr 13 '14 at 22:23

We know that $$\lim_{a\to\infty}\left(\int^a_{-a}e^{-x^2}dx\right)^2=\lim_{a\to\infty}\dfrac{1}{4}\pi\left(\operatorname{erf}(a)^2+\operatorname{erf}(-a)^2-2\operatorname{erf}(a)\operatorname{erf}(-a)\right)=\\ \dfrac{\pi}{4}(1+1-(-2))=\pi$$ Hence, I am led to believe that this is a bug in the calculator itself, since the value should be getting closer to $\pi$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.