Totally OT: Colliding blocks that compute pi
Mar 18, 2025
Last reply: 1 year ago
26 Replies
formatting link
The older videos about this way to get PI are among my favourite PI day videos. \o/
I haven't seen this update yet. So far I only bookmarked it in my RSS feeds for somewhen later.
Apropos PI day ... there is a PI related example in 9front's dc.1 man page ...
formatting link
------------------------------------------------------------------------ # pi example from 9front's dc.1 man page #
1 sq 180 sr 60 st 2 si [ 3 li * 1 + d 1 + * 3 * su li 27 * 12 - lq * 5 lr * + lt 5 * / d 48 + P sy 10 lq li d 2 * 1 - * * * 10 lu lq li 5 * 2 -- lr + ly lt *
------------------------------------------------------------------------
Do the used constants trigger someone's memory about which algorithm that may be?
I do like playing with DC, but turning others' un-commented code back to readable maths so far was not among my just for fun DC puzzles.
Did you know you can compute π just by dropping a needle?
formatting link
------------------------------------------------------------------------ ~$ gdate -d@$(printf "%d" 0x7fffffff) +%H.%M
03.14------------------------------------------------------------------------
Easy to remember, eh?
But I still prefer 355/113.
.-----+-----. .----+----. | The END | | Repent! | | is neigh! | ·----+----· ·-----+-----· | _ _ _ | |\°v° °v° ò.ó/| |_|\/|_|) /|_|
----------------------------^-^--^-^-----^-^----------------------------
Pi keeps showing up uninvited.
formatting link
An eul spill?
In message snipped-for-privacy@tilde.institute, yeti snipped-for-privacy@tilde.institute writes
I just remember 3.14159 - close enough for government work .
Brian
Hamilton was guilty of a bit of graffiti in his day.
formatting link
ue-mathematical-shrine-1.318509>
Brjan
How I wish I could calculate pi
3.141592 - close enough for rocket science! :-)
Nay, nay, Neddy, you daft donkey.
Your computer can do it!
import decimal
Dec = decimal.Decimal decctx = decimal.getcontext() decctx.prec = 64
def decimal_pi(): with decimal.localcontext() as decctx : decctx.prec += 2 # extra digits for intermediate steps t = Dec(3) # substitute 3.0 for regular floats lasts, s, n, na, d, da = 0, 3, 1, 0, 0, 24 nr_steps = 0 while s != lasts : nr_steps += 1 lasts = s n, na = n + na, na + 8 d, da = d + da, da + 32 t = t * n / d s += t #end while #end with print("nr_steps = %d" % nr_steps) return +s # unary plus applies the new precision #end decimal_pi
print(decimal_pi())
output:
nr_steps = 104 3.141592653589793238462643383279502884197169399375105820974944592
Taken from a presentation I did here
formatting link
. I tried continued fractions, but found them a waste of time.
Aren't we glad that wasn’t the only place he wrote up his discovery ...
“I have discovered a most marvellous proof, but this bridge is too small to contain it.”
e^(2pi)i = +1
Shoulda been 6.28
john larkin snipped-for-privacy@glen--canyon.com wrote at 22:02 this Tuesday (GMT):
Pi is hidden in a lot of things.
formatting link
We have terrible graffiti thugs in San Francisco.
I tought I τ a puddy-tat ...
So much of that is the fault of Euler's identity.
--scott
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required