기본 콘텐츠로 건너뛰기

pandas_ta를 적용한 통계적 인덱스 지표

삼각함수 미분공식

1. $f(x)=x^n → f′(x)=nxn-1 or  \frac{d}{dx}(x^n)=nx^{n-1}$

위 식을 증명하기 위해서는  n이 양수라고 가정합니다. 또한 이항정리를 사용합니다. 
<이항정리> 
$(a+b)^n=\sum^n_{k=0}\left(^n_k \right) a^{n-k}b^{k}\\=a^n+\left(^n_1 \right)a^{n-1}b+\left(^n_2 \right)a^{n-2}b^2+ \cdots +\left(^n_{n-1} \right)ab^{n-1}+\left(^n_n \right)ab^n\\=a^n+na^{n-1}b+\frac{n(n-1)}{2!}a^{n-2}b^2+\frac{n(n-1)(n-2)}{3!}a^{n-3}b^3+\cdots+nab^{n-1}+b^n$
위 식의 전개에서 
$\left( \begin{matrix} n \\k  \end{matrix} \right) =\frac { n! }{ k!(n-k)! } ,\quad n!=n\cdot (n-1)\cdot \cdots \cdot 2\cdot 1$
f(x)=xn 이라고 하면 
$f^\prime(x)=\lim_{h \to 0}\frac{(x+h)^n-x^n}{h} \\=\lim_{h \to 0}\frac{(x^n+nx^{n-1}h+\frac{n(n-1)}{2!}x^{n-2}h^2+\frac{n(n-1)(n-2)}{3!}x^{n-3}h^3+\cdots+nxh^{n-1}+h^n)-x^n}{h} \\=\lim_{h \to 0} \; nx^{n-1}+\frac{n(n-1)}{2!}x^{n-2}h+\frac{n(n-1)(n-2)}{3!}x^{n-3}h^2+\cdots+nxh^{n-2}+h^{n-1} \\=nx^{n-1}$

2. $\lim_{\theta \to 0} \frac{sin \theta}{\theta}=1$  


위 그림은 원위의 두 접선을 기준으로 작성된 것으로 다음을 유도 할 수 있습니다. 증명과정을 간단히 하기 위해  0 ≤ θ≤ π/2 와 θ → 0을 가정합니다. 
arc AC < $\overline{AB} +\overline{BC}$ (1)
그림으로 부터 $\overline{BC}<\overline{BD},\; \overline{AB}+\overline{BD}=\overline{AD}$를 알 수 있습니다. 그러므로 식 (1)은 다음과 같이 수정할 수 있습니다. 
arc AC <$ \overline{AB} +\overline{BC}<\overline{AB} +\overline{BC}=\overline{AD}$ (2)
$tan\theta\; =  \frac{\overline{AD}}{\overline{AO}} \rightarrow \overline{AD}=tan\theta\; \overline{AO}=tan \theta, \quad \because (\overline{AO}=1)$  
그러므로 식 (2)는  식(3)으로 수정됩니다. 
arc AC<$\overline{AD}$= tan θ $\overline{AD}$=tan θ (3)
여기서 θ와 radian 즉, 원의 각과 원의 길이의 관계를 생각해 봅니다. 
360: θ=2πr: arc AC (r= 반지름) 
arc AC=θr=θ $\overline{OA}$=θ
위 결과를 식(3)에 대입하여 정리하면 다음과 같습니다. 
arc AC= θ < tan θ =$\frac{sin \theta}{cos \theta}$ (4)
위 그림에서 식 5 관계가 성립합니다. 
$\overline{CE} < \overline{AC}$ < arc AC (5)
식 (5)는 다음과 같이 정리되므로 식 (5)는 식(6)과 같이 재정리됩니다. 
sinθ=$\frac{\overline{CE}}{\overline{OC}} \rightarrow \overline{CE}=sin \theta\;\overline{OC}$=sinθ 
$\overline{CE}$=sinθ < $\overline{AC}$< arc AC = θ (6)
그러므로 식(6)의 양변을 θ로 나누어 주면 다음이 성립됩니다. 
$\frac{sin \theta}{\theta}<1$ (7)
식 (4)와 (7)을 결합하면 
$cos θ < \frac{sinθ}{θ} < 1$
$\lim_{\theta \to 0} cos \theta = 1, \quad \lim_{\theta \to 0}=1 \rightarrow \lim_{\theta \to 0}\frac{sin \theta}{\theta} =1 \quad \text{Eq 1}$
cos θ는 θ = 0 연속입니다. 즉, 
$\lim_{\theta \to 0^-} cos \theta = 1, \lim_{\theta \to 0^+} cos \theta = 1$
그러므로 Eq 1 역시 θ = 0에서 연속입니다.

3. $\lim_{\theta \to 0} \frac{cos\theta -1}{\theta}=0 $

$\lim_{\theta \to 0}\frac{cos \theta -1}{\theta}\\=\lim_{\theta \to 0}\frac{(cos \theta -1)(cos \theta +1)}{\theta(cos \theta +1)}\\=\lim_{\theta \to 0}\frac{((cos \theta)^2 -1)}{\theta(cos \theta +1)}$(1)
삼각함수의 특성 중에 다음식을  (1) 에 대입합니다. 
sin2θ+cos2θ=1 → cos2θ-1=-sin2θ
$\lim_{\theta \to 0}\frac{cos^2 \theta -1}{\theta(con \theta+1)}\\=\lim_{\theta \to 0}\frac{-sin^2 \theta}{\theta(con \theta+1)}\\=\lim_{\theta \to 0}\frac{sin \theta}{\theta}\frac{-sin \theta}{cos \theta+1}\\= \quad \lim_{\theta \to 0}\frac{sin \theta}{\theta} \lim_{\theta \to 0}\frac{-sin \theta}{cos \theta+1}$(2)
 (2) 에서 
$ \lim_{\theta \to 0}\frac{sin \theta}{\theta}=1 $입니다. (2번 증명 참조)
>>> from sympy import *
>>> t=symbols("t")
>>> limit(t, t, 0)
0
그러므로 다음과 같이 계산됩니다. 
$\lim_{\theta \to 0}\frac{sin \theta}{\theta} \lim_{\theta \to 0}\frac{-sin \theta}{cos \theta+1}=1\cdot 0=0$

4. sin(x)

$\frac{d}{dx}(sin(x))=\lim_{h \to 0}\frac{sin(x+h)-sin(x)}{h}$
위 식에서 sin(x+h)은 다음과 같이 전개할 수 있습니다. 
sin(x+h)=sin(x)cos(h)+cos(x)sin(h)
$\frac{d}{dx}(sin(x))=\lim_{h \to 0}\frac{sin(x+h)-sin(x)}{h}\\=\lim_{h \to 0}\frac{sin(x)cos(h)+cos(x)sin(h)-sin(x)}{h}\\=\lim_{h \to 0}\frac{sin(x)(cos(h)-1)}{h}+\lim_{h \to 0}\frac{cos(x)sin(h)}{h}\\=sin(x)\lim_{h \to 0}\frac{cos(h)-1}{h}+cos(x)\lim_{h \to 0}\frac{sin(h)}{h}\\=sin(x)\cdot0+cos(x)\cdot1=cos(x)$

5.cos(x)

$\frac{d}{dx}(cos(x))=\lim_{h \to 0} \frac{cos(x+h)-cos(x)}{h}$
위 식의 cos(x+h)는 다음과 같이 전개할 수 있습니다. 
cos(x+h)=cos(x)cos(h)-sin(x)sin(h)
$\frac{d}{dx}(cos(x))=\lim_{h \to 0} \frac{cos(x)cos(h)-sin(x)sin(h)-cos(x)}{h}\\=\lim_{h \to 0} cos(x)\frac{cos(h)-1}{h}-sin(x)\lim_{h \to 0}\frac{sin(h)}{h}\\=cos(x)\cdot 0-sin(x)\cdot 1=-sin(x)$

6.tan(x)

$tan(x)=\frac{sin(x)}{cos(x)}$
$\frac{d}{dx}tan(x)=\frac{d}{dx}\left(\frac{sin(x)}{cos(x)}\right)\\=\frac{cos(x)cos(x)-sin(x)(-sin(x))}{cos^2(x)}\\=\frac{cos^2(x)+sin^2(x)}{cos^2(x)}=\frac{1}{cos^2(x)}=sec^2(x)$

7. 이외의 다른 삼각함수의 미분 공식은 다음과 같습니다. 

$\frac{d}{dx}cot(x)=-csc^2(x)$
$\frac{d}{dx}sec(x)=sec(x)tan(x)$
$\frac{d}{dx}csc(x)=-csc(x)cot(x)$

댓글

이 블로그의 인기 게시물

[Linear Algebra] 유사변환(Similarity transformation)

유사변환(Similarity transformation) n×n 차원의 정방 행렬 A, B 그리고 가역 행렬 P 사이에 식 1의 관계가 성립하면 행렬 A와 B는 유사행렬(similarity matrix)이 되며 행렬 A를 가역행렬 P와 B로 분해하는 것을 유사 변환(similarity transformation) 이라고 합니다. $$\tag{1} A = PBP^{-1} \Leftrightarrow P^{-1}AP = B $$ 식 2는 식 1의 양변에 B의 고유값을 고려한 것입니다. \begin{align}\tag{식 2} B - \lambda I &= P^{-1}AP – \lambda P^{-1}P\\ &= P^{-1}(AP – \lambda P)\\ &= P^{-1}(A - \lambda I)P \end{align} 식 2의 행렬식은 식 3과 같이 정리됩니다. \begin{align} &\begin{aligned}\textsf{det}(B - \lambda I ) & = \textsf{det}(P^{-1}(AP – \lambda P))\\ &= \textsf{det}(P^{-1}) \textsf{det}((A – \lambda I)) \textsf{det}(P)\\ &= \textsf{det}(P^{-1}) \textsf{det}(P) \textsf{det}((A – \lambda I))\\ &= \textsf{det}(A – \lambda I)\end{aligned}\\ &\begin{aligned}\because \; \textsf{det}(P^{-1}) \textsf{det}(P) &= \textsf{det}(P^{-1}P)\\ &= \textsf{det}(I)\end{aligned}\end{align} 유사행렬의 특성 유사행렬인 두 정방행렬 A와 B는 'A ~ B' 와 같...

[sympy] Sympy객체의 표현을 위한 함수들

Sympy객체의 표현을 위한 함수들 General simplify(x): 식 x(sympy 객체)를 간단히 정리 합니다. import numpy as np from sympy import * x=symbols("x") a=sin(x)**2+cos(x)**2 a $\sin^{2}{\left(x \right)} + \cos^{2}{\left(x \right)}$ simplify(a) 1 simplify(b) $\frac{x^{3} + x^{2} - x - 1}{x^{2} + 2 x + 1}$ simplify(b) x - 1 c=gamma(x)/gamma(x-2) c $\frac{\Gamma\left(x\right)}{\Gamma\left(x - 2\right)}$ simplify(c) $\displaystyle \left(x - 2\right) \left(x - 1\right)$ 위의 예들 중 객체 c의 감마함수(gamma(x))는 확률분포 등 여러 부분에서 사용되는 표현식으로 다음과 같이 정의 됩니다. 감마함수는 음이 아닌 정수를 제외한 모든 수에서 정의됩니다. 식 1과 같이 자연수에서 감마함수는 factorial(!), 부동소수(양의 실수)인 경우 적분을 적용하여 계산합니다. $$\tag{식 1}\Gamma(n) =\begin{cases}(n-1)!& n:\text{자연수}\\\int^\infty_0x^{n-1}e^{-x}\,dx& n:\text{부동소수}\end{cases}$$ x=symbols('x') gamma(x).subs(x,4) $\displaystyle 6$ factorial 계산은 math.factorial() 함수를 사용할 수 있습니다. import math math.factorial(3) 6 a=gamma(x).subs(x,4.5) a.evalf(3) 11.6 simpilfy() 함수의 알고리즘은 식에서 공통사항을 찾아 정리하...

유리함수 그래프와 점근선 그리기

내용 유리함수(Rational Function) 점근선(asymptote) 유리함수 그래프와 점근선 그리기 유리함수(Rational Function) 유리함수는 분수형태의 함수를 의미합니다. 예를들어 다음 함수는 분수형태의 유리함수입니다. $$f(x)=\frac{x^{2} - 1}{x^{2} + x - 6}$$ 분수의 경우 분모가 0인 경우 정의할 수 없습니다. 이와 마찬가지로 유리함수 f(x)의 정의역은 분모가 0이 아닌 부분이어야 합니다. 그러므로 위함수의 정의역은 분모가 0인 부분을 제외한 부분들로 구성됩니다. sympt=solve(denom(f), a); asympt [-3, 2] $$-\infty \lt x \lt -3, \quad -3 \lt x \lt 2, \quad 2 \lt x \lt \infty$$ 이 정의역을 고려해 그래프를 작성을 위한 사용자 정의함수는 다음과 같습니다. def validX(x, f, symbol): ① a=[] b=[] for i in x: try: b.append(float(f.subs(symbol, i))) a.append(i) except: pass return(a, b) #x는 임의로 지정한 정의역으로 불연속선점을 기준으로 구분된 몇개의 구간으로 전달할 수 있습니다. #그러므로 인수 x는 2차원이어야 합니다. def RationalPlot(x, f, sym, dp=100): fig, ax=plt.subplots(dpi=dp) # ② for k in x: #③ x4, y4=validX(k, f, sym) ax.plot(x4, y4) ax.spines['left'].set_position(('data', 0)) ax.spines['right...