見出し画像

arxtan の展開

arctanの展開は次の式となります。

$${\displaystyle \arctan x = \sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}x^{2n+1}=x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\frac{x^9}{9}\cdots}$$

これを使い、

$${\displaystyle \frac{\pi}{4}=\arctan 1=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}\cdots}$$

を計算しましたが、このarctanは奥深いものがあるので探ってみます。まず、グラフにすると次の通りになります。

import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(precision=3,suppress=True)
plt.style.use('seaborn-poster')
alphas=[1,1,1]
widths=[2,2,1]
x = np.arange(-1.5,1.5,0.01)
#グラフの作成
formula=[np.arctan(x),np.tan(x),x]
labels = [r'$\arctanx}$',r'$\tanx}$','x']
colors=['r','b','k']
plt.figure(figsize = (10,8))
for fx, label, color ,alpha, w in zip(formula, labels,colors,alphas,widths):
   plt.plot(x,fx, color, label = label ,alpha=alpha,linewidth=w)
plt.grid()
plt.title(r'$\arctan$と$\tan$',fontname="MS Gothic")
plt.xlabel('x')
plt.ylabel('y')
plt.ylim(-2,2)
plt.xticks([-np.pi/2,-np.pi/4,0,np.pi/4,np.pi/2], ['$-1/2\pi$','$-1/4\pi$','0','$1/4\pi$','$1/2\pi$'])
plt.legend()

画像1

青線が tan であるのに対し、赤線は arctan になります。直線 𝑦=𝑥 に対し対称になっており逆関数であることがわかります。

$${y=\arctan x}$$を微分することを考えます。

$${\tan y=x}$$として$${x}$$で微分すると

$${\displaystyle \frac{1}{\cos^2 y}\cdot\frac{dy}{dx}=1}$$なので$${\displaystyle\frac{dy}{dx}=\cos^2y \frac{dx}{dy}=\frac{1}{\cos^2y}}$$

 よって$${\displaystyle(arctan x)^{\prime}=\frac{dy}{dx}=\cos^2y=\frac{\cos^2y(1+\tan^2y)}{1+\tan^2y}=\frac{\cos^2y+\sin^2y}{1+\tan ^2y}=\frac{1}{1+\tan^2y}=\frac{1}{1+x^2}}$$


import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(precision=3,suppress=True)
plt.style.use('seaborn-poster')
alphas=[1,1,1]
widths=[2,2,1]
x = np.arange(-1.5,1.5,0.01)
#グラフの作成
formula=[np.arctan(x),1/(1+x**2),x]
labels = [r'$\arctanx}$',r'$\tanx}$','x']
colors=['r','b','k']
plt.figure(figsize = (10,8))
for fx, label, color ,alpha, w in zip(formula, labels,colors,alphas,widths):
   plt.plot(x,fx, color, label = label ,alpha=alpha,linewidth=w)
plt.grid()
plt.title(r'$\arctan$と$\tan$',fontname="MS Gothic")
plt.xlabel('x')
plt.ylabel('y')
plt.ylim(-2,2)
plt.xticks([-np.pi/2,-np.pi/4,0,np.pi/4,np.pi/2], ['$-1/2\pi$','$-1/4\pi$','0','$1/4\pi$','$1/2\pi$'])
plt.legend()

画像2

これは|x|<1の範囲ではありますが、公比$${-x^2}$$の等比数列と考える考えることができます。

$${\arctan^{\prime}x=\dfrac{1}{1+x^2}=\dfrac{1}{1-(-x^2)}=1-x^2 +x^4-x^6 +x^8\cdots=\displaystyle \sum_{n=0}^\infty (-1)^{n}x^{2n}}$$

この式を$${x}$$について積分すると次の通りになります。

$${\displaystyle \arctan x=x-{\frac {x^{3}}{3}}+{\frac {x^{5}}{5}}-{\frac {x^{7}}{7}}+{\frac {x^{9}}{9}}-\cdots=\sum_{n=0}^{\infty }{\frac {(-1)^{n}}{2n+1}}x^{2n+1}}$$

def expand(num,n):
   total=0
   for i in range(n):
       x=2*i+1
       total+=(-1)**i*num**x/x
   return total
   
   import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(precision=3,suppress=True)
plt.style.use('seaborn-poster')
alphas=[1,0.3,1]
widths=[1,6,1]
x = np.arange(-1.5,1.5,0.01)
#グラフの作成
formula=[np.arctan(x),expand(x,100)]
labels = [r'$\arctanx}$',r'expand']
colors=['b','r']
plt.figure(figsize = (10,8))
for fx, label, color ,alpha, w in zip(formula, labels,colors,alphas,widths):
   plt.plot(x,fx, color, label = label ,alpha=alpha,linewidth=w)
plt.grid()
plt.title(r'$\arctan$と展開式',fontname="MS Gothic")
plt.xlabel('x')
plt.ylabel('y')
plt.ylim(-2,2)
plt.xticks([-np.pi/2,-1,-np.pi/4,0,np.pi/4,1,np.pi/2], 
          ['$-1/2\pi$','-1','$-1/4\pi$','0','$1/4\pi$','1','$1/2\pi$'])
plt.legend()
plt.plot([-1, -1], [-2, 2],color='y',linewidth=1)
plt.plot([1, 1], [-2, 2],color='g',linewidth=1)

画像3

このことから、この展開式は|x|<1の範囲で使えることがわかりました。

この記事が気に入ったらサポートをしてみませんか?