ページへ戻る

+ Links

 印刷 

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

xpwiki:Python/円周率 の変更点

« Prev  
1: 2019-02-16 (土) 02:57:15 njf ソース バックアップ No.1 を復元して編集 現: 2019-02-16 (土) 02:19:38 njf ソース 編集
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