To approximate an arbitrary number of digits of pi with sympy:

  #! pip install sympy gmpy
  import sympy
  sympy.evalf(sympy.pi)
  sympy.N(sympy.pi)
https://docs.sympy.org/latest/modules/evalf.html

RosettaCode > [Python] lists quite a few more: https://rosettacode.org/wiki/Pi#Python

I want to try write the underlying code myself, but thanks!
gmpy2.const_pi(precision=0: =53bits) probably isn't too helpful then either: https://gmpy2.readthedocs.io/en/latest/mpfr.html#gmpy2.const... https://github.com/aleaxit/gmpy/issues/253#issue-499509692

RosettaCode has only one solution to the "Approximate Pi with Rationals (not float64s)" in Python problem.

I remember having seen a few statistical manifestation of Pi demos on YouTube

"Calculating Pi with Darts by Physics Girl [and Veritasium Derek] (PBS LearningMedia)" https://youtube.com/watch?v=M34TO71SKGk

Monte Carlo method: https://en.wikipedia.org/wiki/Monte_Carlo_method

"Inferred value of Pi is never 3.1415" (with pymc) https://discourse.pymc.io/t/inferred-value-of-pi-is-never-3-... https://github.com/pymc-devs/pymc