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の備忘録 (初心者) <数学の基礎計算(三角関数)>

Last updated at Posted at 2024-05-07

僕がPythonのmath library使い方をド忘れした時のための備忘録を作成します。

あくまで記事は使用例です
厳密さを必要とする場合は下記LINKを参照してください。
https://docs.python.org/ja/3/library/math.html

math libraryのimport
import math
三角関数の使用例
theta = math.radians(45)
print(theta)

出力
0.7853981633974483

角度からラジアンに変換
詳細は下記wiki参照

三角関数の計算結果
import math
theta = math.radians(45)

math.sin(theta)
math.cos(theta)
math.tan(theta)

print(math.sin(theta))
print(math.cos(theta))
print(math.tan(theta))

出力
0.7071067811865475
0.7071067811865476
0.9999999999999999

逆三角関数の計算結果
import math
theta = math.radians(45)

math.asin(theta)
math.acos(theta)
math.atan(theta)

print(math.asin(theta))
print(math.acos(theta))
print(math.atan(theta))

出力
0.9033391107665127
0.6674572160283838
0.6657737500283538

双曲線関数の計算結果
import math
theta = math.radians(45)

math.cosh(theta)
math.sinh(theta)
math.tanh(theta)

print(math.sinh(theta))
print(math.cosh(theta))
print(math.tanh(theta))

出力
0.8686709614860095
1.3246090892520057
0.6557942026326724

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?