2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

正接の微分公式と数値計算について

2
Last updated at Posted at 2026-05-04

はじめに

正接の微分の公式は、正弦や余弦の微分の公式と比較してマイナーである。しかし、正接の微分公式は、置換積分などで活躍する。
そこで、今回は、正接の微分の公式を、正接の加法定理から導出する。
その後、数値計算で、その結果が妥当か評価する。

tan(theta)の近似値と真値の比較.png

正接の加法定理

実数$x,y$に対して以下の式が成立する。

\tan(x+y)=\frac{\tan x+\tan y}{1-\tan x\tan y}

ここで、$|h|<<1$であるとき、


\tan{h}=h

とみなせる。したがって、

\tan(x+h)=\frac{\tan x+h}{1-h\tan x }

分母を払って整理すると、以下のようになる。

\tan(x+h)-\tan x =h\{1+\tan(x+h)+\tan x \}

ゆえに、

\frac{\tan(x+h)-\tan x}{h} =1+\tan(x+h)\tan x\to 1+\tan^2{x}=\frac{1}{\cos^2 x}

プログラム

以下のようなプログラムを作成した。ただし、$x=\frac{\pi}{2}$では、正接を定義することができないことに注意する。

python tan_near.py
import numpy as np
import matplotlib.pyplot as plt
import japanize_matplotlib
import math


# --- パラメータ設定 ---
x = 0.99/2 * math.pi   # 積分範囲: 0 〜 2π(cos の1周期分)
n = 100         # 分割数(ステップ数)
h = x / n          # ステップ幅 Δx

tan_x=0
tan_x_ary=[]

# --- オイラー法による数値積分ループ ---
for i in range(n):
    tan_x=(tan_x+h)/(1-tan_x*h)  # tan(x+h) = (tan(x)+tan(h)) / (1-tan(x)*tan(h))
    tan_x_ary.append(tan_x)
    
# --- グラフ描画 ---
theta=np.linspace(0,x,n)
plt.plot(theta,tan_x_ary,label="tan_near(theta)")
plt.plot(theta,np.tan(theta),label="tan(theta)")
plt.xlabel("theta[rad]")
plt.ylabel("tan(theta)の近似値と真値")
plt.legend()
plt.title("tan(theta)の近似値と真値の比較")
plt.savefig("tan(theta)の近似値と真値の比較.png")
plt.show()

tan(theta)の近似値と真値の比較.png

まとめ

今回は、正接の微分の公式を導出した。具体的には、微小区間での近似を行った。
その後、数値計算で、正接関数の近似グラフを描写した。近似精度としては、ほぼ正接関数そのものであった。

参考文献

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?