ページへ戻る

− Links

 印刷 

Python​/円周率 の変更点 :: NJF Wiki

xpwiki:Python/円周率 の変更点

« Prev[3]  
1: 2019-02-16 (土) 02:57:15 njf[4] ソース[5] バックアップ No.1 を復元して編集[6] 現: 2019-02-16 (土) 02:19:38 njf[4] ソース[7] 編集[8]
Line 1: Line 1:
-Pythonで円周率を使うにはmath.piを使います。ver.2,ver.3共に同じです。+Pythonで円周率を使うにはmath.piを使います。ver.2系,ver.3系共に同じです。
 >>> import math  >>> import math
Line 5: Line 5:
結果 結果
 3.141592653589793  3.141592653589793
 +
 +numpyが入っていれば、numpy.piも使えます。
 +
 + >>> import numpy
 + >>> numpy.pi
 +結果
 + 3.141592653589793
 +
 +ver.3.6からは円周率の二倍であるmath.tauが加わりました。
 + >>> import math
 + >>> math.tau
 +結果
 + 6.283185307179586
« Prev[3]