기본 콘텐츠로 건너뛰기

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' 와 같...

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

내용 유리함수(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...

부분분수의 미분

내용 방법 1 방법 2 방법 3 부분분수의 미분 분수의 미분은 일정한 공식 을 적용하여 계산할 수 있습니다. 그러나 분수 자체가 단순한 표현으로 이루어지지 않았다면 미분 과정이나 결과는 매우 복잡할 수 있습니다. 만약 복잡한 분수 함수를 간단한 분수들로 분해할 수 있다면 계산이 보다 간편해질 것입니다. 이와 같이 분해된 간단한 분수들을 부분분수 라고 합니다. 예를 들어 다음 두 분수의 합을 계산해 봅니다. $$\begin{align} \frac{1}{x+1}+\frac{2}{x-1}&=\frac{x-1+2(x+1)}{(x+1)(x-1)}\\ &=\frac{3x+1}{x^2-1} \end{align}$$ 위 과정은 3개 이상의 여러 분수에서도 이루어질 수 있습니다. 또한 역으로 진행될 수 있습니다. 즉, 분수를 부분 분수로 분할할 수 있습니다. 그러나 이러한 과정은 대수분수 (분자의 가장 큰 차수가 분모의 최고의 차수보다 작은 분수)에서만 이루어질 수 있습니다. 예를 들어 $\displaystyle \frac {x^2+2}{x^2-1}$의 경우는 분자와 분모의 차수는 2차로 같습니다. 이러한 경우 다음과 같이 분리할 수 있습니다. $$\frac{x^2+2}{x^2-1}=1+\frac{3}{x^2-1}$$ 위의 식 중 $\displaystyle \frac{3}{x^2-1}$은 분자의 차수가 분모의 차수 보다 낮은 대수 분수이므로 부분 분수로 분리할 수 있습니다. 이와같이 부분 분수로 분해하는 방법은 다음과 같이 몇 가지로 구분할 수 있습니다. 방법 1 위 예의 결과 $\displaystyle \frac{3x+1}{x^2-1}$의 경우를 역으로 생각해 봅니다. 분모의 인수분해가 가능하면 그 분모의 인수에 의해 다음과 같이 분해할 수 있습니다. $$\begin{align} \frac{3x+1}{x^2-1}&=\frac{3x+1}{(x+1)(x-1)}\\ &=\frac{A}{x+1...