0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】NumPyのsin関数、cos関数、tan関数

Posted at

sin関数、cos関数、tan関数の引数は角度ではなくラジアンで指定します。

ラジアンは、角度360°を2π(2×3.14...)、180°をπ(3.14...)として扱う単位です。

例えばsin180°の三角比を求める場合は、「np.sin(np.pi)」とします。結果は「1.2246467991473532e-16」が返ります。最後の「e-16」の「e」はネイピア数ではなく、大きな数や小さな数を表すときに使われる記号です。

■ eの右側に正の整数がある場合
eの左側の小数に、eの右側の回数だけ10を掛けます。
例えば「1.1e2」であれば、1.1に10を2回掛ける、つまり100を掛けるため、「110」を表します。

■ eの右側に負の整数がある場合
eの左側の小数に、eの右側の回数だけ10で割ります。
例えば「1.1e-2」であれば、1.1を10で2回割る、つまり100で割るため、「0.011」を表します。

先ほどの三角比の「1.2246467991473532e-16」は、eの左側の数を10で16回割ります。小数点を左側に16回移動することになるため、ほとんど0に近い数字になります。sin180°の三角比は「0」ですが、円周率のように無限に続く数をコンピュータで計算すると誤差が出るため、このような結果になります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?