RSS Amplifier

Recent Questions - Code Review Meta Stack Exchange · Mar 15, 2025

Would a question asking an unimplemented feature about a fully working script be on-topic here?

0
Sign in to vote or save

This page did not load. You can still read it on the original site — the toolbar below keeps your place in the directory.

Two days ago (or yesterday depending on your timezone) was π-day. So I thought it was a good day to calculate π. I used Machin-like formula to calculate π, in homage of William Shanks , who calculated 527 correct digits of π well before electronic computers. Though I used Newton's Accelerated Arctangent Series and I got my terms from here . I rewrote the arctangent series to make it do everything…

Two days ago (or yesterday depending on your timezone) was π-day. So I thought it was a good day to calculate π.

I used Machin-like formula to calculate π, in homage of William Shanks, who calculated 527 correct digits of π well before electronic computers. Though I used Newton's Accelerated Arctangent Series and I got my terms from here.

I rewrote the arctangent series to make it do everything in integer domain.

enter image description here

And it works. See this Stack Overflow question for an earlier iteration of my implementation.

Now I have re-implemented it again so that I can get as many correct digits of π as I want without using any libraries, and using these terms: ((44, 57), (7, 239), (-12, 682), (24, 12943)), I was able to get the first 1024 decimal places of π in 292 iterations:

In [139]: Machin_Pi.get_n_places(4, 1024)
Out[139]:
(292,
 '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788')

But I haven't been able to accelerate the convergence of the series further, I have tried to make it converge faster by using binary split (though if I understand correctly it gets the same result in less iterations?), but I cannot make it work, my math is very rusty, I am a high-school dropout and the last year I attended school was 2017...

Would such a question be on topic if I am asking to make the series converge faster?

Read on codereview.meta.stackexchange.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.