1

I'm a novice here, with little better than an average high school student's knowledge in mathematics. That said, I'm an eager learner and don't shy away from difficult tasks. I could use a nod in the right direction. For some reason, this week I wanted to see how many decimal digits of pi I could come up with.

I first read up on an ancient technique of computing the area of regular polygons with a fixed radius but ever-increasing number of sides. I constructed a simple spreadsheet (I used Google Sheets) to allow me to experiment with the number of sides. By dividing the area I computed by the square of the radius I was able to get increasingly-accurate approximations of pi. As I expected, as the number of sides increased, the area approached what I would expect for a circle of the same radius. It took 12 sides to get 3 as the first digit before the decimal point. At 120 sides, I had 3.14. By 1000 sides, 3.1415. And when I got to the ridiculous point of 50 million sides, I got 3.14159265358979 as a result, which looked pretty good to me.

Then, I wanted greater precision. I formatted the output cell to show more decimal places, but this only yielded me answers like 3.14159265358979000000000, which undoubtedly tells me I ran up against the maximum precision of the software.

Given my limited math education (algebra, geometry, some trig, no calculus), what could I try next to get me, say, 25 digits of pi? I have MS Office, Google. I'm not afraid to dip my toes in programming, but I don't know of any full-featured programming tools that don't cost money. (I'm not prepared to invest money in this little project.)

How can I get greater precision? It seems like I'm bounded by the software only having a certain amount of bits available in the cell.

  • Search for "leibniz series calculate pi" and follow some links. Here is one. https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80 Search too for online infinite precision calculator. – Ethan Bolker Sep 21 '21 at 01:45
  • Download PARI/GP for free and even run a version in a web browser. It has arbitrary precision arithmetic and easy to use. – Somos Sep 21 '21 at 02:17
  • Check this out: http://stanleyrabinowitz.com/bibliography/spigot.pdf – Hans Lundmark Sep 21 '21 at 07:29

1 Answers1

0

If you’re willing to do some tedious addition and subtraction you can calculate pi using the following:

$\pi=\dfrac41-\dfrac43+\dfrac45-\dfrac47+\dfrac49…$

PiGuy314
  • 637
  • I also tried a similar algorithm that gave pi/4, but ran into the same precision issue. Is your suggestion that I abandon my spreadsheet and do it by hand? – nuggethead Sep 21 '21 at 01:45
  • @nuggethead This shouldn't be hard to do in code. You can go to cpp.sh to run some c++ code with no problem – TheBestMagician Sep 21 '21 at 01:50
  • With this formula, it is a snap to calculate each term in one line of a spreadsheet, and copy your formula down as many rows as you choose. However, while this series does converge to pi, it converges very slowly. If you want something faster, look at the BBP algorithm. https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula – user317176 Sep 21 '21 at 01:51
  • @nuggethead The formula is best computed via software (e.g. Java, C, Python, ...) that has a BigInteger facility, as Java does. If you know Calculus: it is based on calculating $$(\pi/4) = \text{arctan}(x)|{x=0}^{x=1} = \int_0^1 \frac{dx}{1 + x^2}.$$ This also equals $$\int_0^1 (1 - x^2 + x^4 - x^6 + \cdots - \cdots)dx.$$ This evaluates to $$x - (x^3/3) + (x^5/5) - (x^7/7) + \cdots - \cdots|{x = 0}^{x=1}.$$ – user2661923 Sep 21 '21 at 01:52
  • This answer gives another method of finding pi,but doesn't address the question of what tool to use. – nuggethead Sep 21 '21 at 13:22
  • @TheBestMagician if you write that as an answer if gladly accept it. I didn't know of cpp.sh and it may just be the answer to my problem. – nuggethead Sep 21 '21 at 13:24