Can the Apple 2 Compute pi? If so what software?

## Applefritter Talk

## Anonymous

## User login

Please support the defense of Ukraine.

Direct or via Unclutter App

## Active forum topics

## Recent content

## Navigation

No Ads.

No Trackers.

No Social Media.

All Content Locally Hosted.

Two Terabytes and Growing.

Built on Free Software.

We have complied with zero government requests for information.

Yes, it can be done in BASIC. See page 15 of this journal from 1978: http://archive.6502.org/publications/micro/micro_06_aug_1978.pdf

]

`PI=3.1415926535`

]

`PRINT PI`

3.14159266

How much precision were you looking for?

I am particular to tau: τ which is 2 * PI

]

`TAU = 8 * ATN(1)`

]

`PRINT TAU`

6.28318531

I don't think you get the point. The question was about computing PI to a very large number of decimals, not just 8.

I found this to be a clever way to calculate Pi. Not sure who came up with it, but it would be easy to write a basic program to do this.

Take 4 and

subtract"4 divided by 3".Then

add"4 divided by 5".Then

subtract"4 divided by 7".Continue alternating between adding and subtracting fractions with a numerator of 4 and a denominator of each subsequent odd number.

The more times you do this, the closer you will get to pi.

It would be nice to compare the calculation time to (say) 20 digits or so using Applesoft Basic vs. a Binary run-able calculation.

It's an application of the Taylor series. See https://math.hmc.edu/funfacts/taylor-made-pi/

That's the Leibniz series:

Pi/4 = 1 - 1/3 + 1/5 - 1/7 ....

It is based on the Taylor series for the arctangent function

ATAN(X) = X - X/3 + X/5 - X/7 ...

knowing that ATN 1 = pi/4

unfortunately it converges logarithmically. Basically you have to double the number of terms you need for each additional digit of accuracy. Literally millions of terms are needed for 6 or 7 digits of accuracy.

The most efficient series I believe is the Bailey-Borwein-Plouffe formula and Bellard's formula

https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula

https://en.wikipedia.org/wiki/Bellard%27s_formula

It can directly generate binary digits of pi. It is used in all of the big pi computation projects.