Flop's Pi Calculator
Version 1 (and probably the only one)
-------------------------------------

This program was written in honor of the upcoming Pi Day, March 14, 2003, in the
hope that its author could study a bit during free blocks... :)

Its primary purpose you can probably guess: to calculate this bizarre number
called Pi. I've checked its output against other reliable sources and found it
to be accurate. It makes use of the following magical property (I don't recall
the source at the moment) -

 12 arccot 18 + 8 arccot 57 - 5 arccot 239 = pi/4.

Of course you can also calculate pi/4 as the arctangent (or arccotangent) of 1,
but in that case the terms are much bigger and take a lot longer to reach the
desired precision. There are a handful of other formulae that work, but this one
looked cool in a weird sort of way.

The arccotangent is computed as

 arccot x = Sigma(n=0,inf) (-1)^n / (2n+1)(x^(2n+1)).


You will probably have problems up around 2^14 digits or so; luckily no 83
actually has enough (usable) RAM for this to be a problem.

------------
Installation
------------

TI-83: send the files PI.83P, ZPI.83P. Also required is TI's ZASMLOAD.

TI-83+: send the files PI.8XP, ZPI.8XP.

-----
Usage
-----

Run program PI. This is simply a wrapper for the program itself.

It will ask you how many digits to compute. You'll need 2 bytes of RAM per
decimal digit to store four base 100 numbers.

At this screen, type using 0-9. Del or Left-arrow is backspace, Enter to accept.
Mode or 2nd+Quit will get you out, fast.

After you press Enter, the program will start calculating. It may be doing this
for a long time. The counter at the bottom is the number of terms that have been
processed. Be patient.

If you aren't patient enough, press On to pause the calculation, at which point
you can quit if you like.

Each term requires two multiple-precision divisions, which each require k 24-bit
divisions, if k is the number of digits. The number of terms needed will also be
roughly proportional to the number of digits. So we can say that the computation
is O(n^2), that is, it will finish within an amount of time proportional to the
square of the number of digits.

When you finally have your pi, it will be displayed across the screen, allowing
you to appreciate a full 200 digits at once...
At this screen, use the up and down arrows to scroll up and down, or the left
and right arrows to scroll by pages.

--
Me
--

If you have any problems with this program, tell me about them at
benjamin@ecg.mit.edu.  Don't kill me if it doesn't work quite right on your 83,
because I don't have one.

And oh, don't forget that this is an assembly program, it can and will crash
your calculator, and it comes without warranty of any kind. Run it at your own
risk.

I don't expect to do anything further with this program, but if you can think of
anything else it ought to do, let me know.

If you would like to make use of the multiple-precision math routines used in
this program, I'd like to hear about that as well. They could certainly be
useful for something...

You are free to redistribute and modify this program under the terms of the GNU
General Public License, version 2 or later. Please do so.

Thanks go to...

* Everyone at TI for making my life so interesting.
* Everyone who has worked over the years to make assembly programming possible.
* Archimedes, and all the rest of those ancient Geeks.
* Whoever invented apple pi.
* ... and you, of course!

--------------
Benjamin Moody
March 10, 2003
