Post Reply 
Creating digits of pi
02-09-2018, 02:42 AM
Post: #13
RE: Creating digits of pi
(02-09-2018 02:01 AM)Mike (Stgt) Wrote:  
(02-08-2018 11:48 PM)Gerson W. Barbosa Wrote:  Madhava-Leibniz is interesting, [...]

\[{\displaystyle {\frac {\pi }{4}}=1-{\frac {1}{3}}+{\frac {1}{5}}-{\frac {1}{7}}+\cdots +{\frac {(-1)^{n}}{2n+1}}+\cdots } \]

Seems I confused by so many formulas. What you quote is the Madhava-Leibniz formula. In contrast what I use is a more rapidly converging series also from Madhava.
Code:
s = 1
n = 1
DO m = 3 by 2 UNTIL m = m + n
   n = n / -3
   s = s + n / m
end
Pi = 2 * s * Sqrt(3)
This needs about 2 iterations per correct digit of Pi. In my list I marked it falsely with 'Madhava-Leibniz'.

To reduce the loop overhead I merged two steps (what results in a remarkable gain on my system):
Code:
s = 1
n = 1
DO m = 3 by 4 UNTIL m = m + n
   n = n / 9
   s = s + n / (m + 2) - 3 * n / m
end
Pi = 2 * s * Sqrt(3)

BTW, instead of tantalizing your real machine for 6 hrs, I suggest a well known emulator of it. Recently I set it to authentic speed for some reason, and I am so glad I can switch it back to full speed. Could help in this case too.

Ciao.....Mike

You're still limited to the precision of a variable (Pi), right? How would you go beyond 12 or 13 digits? If you can't, why go to all that trouble to get a number you can get with a single command. That's not a rhetorical question, I'd really like to know.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Creating digits of pi - brickviking - 02-06-2018, 12:24 AM
RE: Creating digits of pi - Joe Horn - 02-06-2018, 01:38 AM
RE: Creating digits of pi - toml_12953 - 02-06-2018, 09:24 PM
RE: Creating digits of pi - brickviking - 02-06-2018, 10:38 PM
RE: Creating digits of pi - brickviking - 02-08-2018, 04:22 AM
RE: Creating digits of pi - toml_12953 - 02-08-2018, 01:02 PM
RE: Creating digits of pi - TASP - 02-07-2018, 10:30 PM
RE: Creating digits of pi - pier4r - 02-09-2018, 02:59 PM
RE: Creating digits of pi - emece67 - 02-10-2018, 09:14 PM
RE: Creating digits of pi - TASP - 02-11-2018, 12:12 AM
RE: Creating digits of pi - ttw - 02-12-2018, 03:59 AM
RE: Creating digits of pi - EdS2 - 02-17-2018, 12:27 PM
RE: Creating digits of pi - EdS2 - 02-21-2018, 11:01 AM
RE: Creating digits of pi - pier4r - 02-17-2018, 04:25 PM
RE: Creating digits of pi - brickviking - 02-17-2018, 09:27 PM
RE: Creating digits of pi - pier4r - 02-23-2018, 01:34 PM
RE: Creating digits of pi - SlideRule - 05-13-2018, 05:09 PM



User(s) browsing this thread: 2 Guest(s)