【Python】三角関数の加法定理 cos編

■三角関数の加法定理

すぐにわかる三角比の値、θ = 30°、45°、60°を使用して、
15°や105°の値を求めることが可能となる。

★今回はcos編のみ紹介

■三角関数の加法定理 cosの公式

cosの加法定理は以下の通り。

■例題

問題1
cos(15°)を加法定理を使用して求める。

問題2
cos(75°)を加法定理を使用して求める。

【特記事項】
ちなみに、pythonでは、
加法定理を使用しなくても、そのままcos(15°)、cos(75°)を求めることはできる。

■サンプルコード

▼問題1

# -*- Coding:UTF-8 -*-
import math

# 度数を変数に格納
degree = 15
tmp_degree1 = 60
tmp_degree2 = 45

# 度数をラジアンに変換
radian = math.radians(degree)
tmp_radian1 = math.radians(tmp_degree1)
tmp_radian2 = math.radians(tmp_degree2)

# 加法定理 cos(α-β)
result = math.cos(radian)

# 答え(少数第2位で表示)
print('cos(15°) = ', round(result, 2))

# 加法定理 cosαcosβ - sinαsinβ
result = math.cos(tmp_radian1) * math.cos(tmp_radian2) + math.sin(tmp_radian1) * math.sin(tmp_radian2)

# 答え(少数第2位で表示)
print('cos60°cos45° + sin60°sin45° = ', round(result, 2))

▼問題2

# -*- Coding:UTF-8 -*-
import math

# 度数を変数に格納
degree = 75
tmp_degree1 = 45
tmp_degree2 = 30

# 度数をラジアンに変換
radian = math.radians(degree)
tmp_radian1 = math.radians(tmp_degree1)
tmp_radian2 = math.radians(tmp_degree2)

# 加法定理 cos(α+β)
result = math.cos(radian)

# 答え(少数第2位で表示)
print('cos(75°) = ', round(result, 2))

# 加法定理 cosαcosβ - sinαsinβ
result = math.cos(tmp_radian1) * math.cos(tmp_radian2) - math.sin(tmp_radian1) * math.sin(tmp_radian2)

# 答え(少数第2位で表示)
print('cos45°cos30° - sin45°sin30° = ', round(result, 2))

■実行結果

▼問題1

cos(15°) =  0.97
cos60°cos45° + sin60°sin45° =  0.97

▼問題2

cos(75°) =  0.26
cos45°cos30° - sin45°sin30° =  0.26
タイトルとURLをコピーしました