March 14th, 3/14, pi day

9 views
Skip to first unread message

E. Matt Armstrong

unread,
Mar 13, 2021, 6:33:22 PM3/13/21
to Upstate Carolina Linux Users Group

Python script for pi day! I cheated and used a library, but why reinvent the wheel.

Jas Eckard

unread,
Mar 13, 2021, 11:22:51 PM3/13/21
to UCLUG
Matt! I didn't know Google had something called "Colab" to handle
Jupyter Notebooks! Man, you're always introducing me to _something_!

And yes, I think it's cheating. :^) Also, it's not very helpful if
all I can see are the last 5000 values, I need the first ones.
Doesn't pi start with 3.14?
> --
> You received this message because you are subscribed to the Google Groups "Upstate Carolina Linux Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to uclug+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/uclug/73121078-feb3-488d-b907-c7a11043ef74n%40googlegroups.com.

E. Matt Armstrong

unread,
Mar 14, 2021, 6:14:04 PM3/14/21
to Upstate Carolina Linux Users Group
Colab was just an easy way for me to share a python environment. I think it is meant for training tensor flow models. It is a neat little Jupyter Notebook clone from Google, but they could kill it any day. lol

Doh! The library I used stops at a million and 2 digits. The 5000 lines is the buffer limit. I could log it to a file but I'd be limited by disk space. There are many algorithms to calculate pi and it's going to take me a bit to wrap my head around the maths. I'm more of a phi person than a pi guy.

I found this on the world record. This is crazy! Run your own image starting at $40 a day, great ad by Google.


M@

Robert Meier

unread,
Apr 5, 2021, 9:31:55 PM4/5/21
to uc...@googlegroups.com
Matt, Jas,

Believing the pi challenge was for the April meeting, i wrote an O(n^2) algorithm to successively approximate 4 atan(1) to infinite digits.

Running in python-3.9.2, under Termux, on my Android-10 cell phone, it computes 1000+ digits in 30sec, 8000+ digits in 40min, ...  My laptop runs about 8x faster (and cost less).  My workstation at Chrysler 2years ago ran about 500x faster (and cost 50x more).

I can probably help you with the math.

Many pi calculation algorithms are really simple, but also very sensitive to any overlooked error in hardware or firmware.
Does anyone remember the infamous intel pentium fdiv bug (https://en.m.wikipedia.org/wiki/Pentium_FDIV_bug)?

Dr. B


Reply all
Reply to author
Forward
0 new messages