• R/O
  • SSH



Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonrubyphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

A small kernel of code for playing with Galois fields of arbitrary characteristic

Commit MetaInfo

Révision0b77fa2db6fa3a13e8db4381e43d20e076ae3cfd (tree)
l'heure2020-01-13 07:45:56
AuteurEric Hopper <hopper@omni...>
CommiterEric Hopper

Message de Log

Turning this into a grab-bag of math stuff.

Change Summary


diff -r 8afc24c8f8d1 -r 0b77fa2db6fa ratpi.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ratpi.py Sun Jan 12 14:45:56 2020 -0800
@@ -0,0 +1,8 @@
1+from fractions import Fraction as F
3+"""I have no better place to put this. This is a quickly converging series for
4+computing a rational approximation of pi. For when you want more precision
5+than math.pi will give you."""
7+def ratpi(n):
8+ return sum(F(1/16**k)*(F(4,8*k+1) - F(2,8*k + 4) - F(1,8*k+5) - F(1, 8*k+6)) for k in range(0, n))