Pythonで円周率を使うにはmath.piを使います。ver.2系,ver.3系共に同じです。
>>> import math >>> math.pi
結果
3.141592653589793
numpyが入っていれば、numpy.piも使えます。
>>> import numpy >>> numpy.pi
結果
3.141592653589793
ver.3.6からは円周率の二倍であるmath.tauが加わりました。
>>> import math >>> math.tau
結果
6.283185307179586
Page Info | |
---|---|
Page Name : | Python/円周率 |
Page aliases : | None |
Page owner : | njf |
Can Read | |
Groups : | All visitors |
Users : | All visitors |
Can Edit | |
Groups : | All visitors |
Users : | All visitors |
Counter: 912,
today: 1,
yesterday: 0
Princeps date: 2019-02-16 (Sat) 02:57:15
Last-modified: 2019-02-16 (Sat) 03:19:38 (JST) (1279d) by njf