기본 콘텐츠로 건너뛰기

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

latex equation, HTML symbol 정리

구글 블로그에서 latex수식을 적용하기 위해서 

1) 블로그에 메인창에서 테마로 이동 
2) 우측 상단의 $vdots$클릭하여 HTML 편집기로 이동
3) <head> ~</head> 사이에 다음을 입력 
<script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' type='text/javascript'/>

1. 조건에 따른 여러 함수 표현

\[f(x) = \left\{
  \begin{array}{lr}
    x^2 & : x < 0\\
    x^3 & : x \ge 0
  \end{array}
\right.

\[f(x) = \left\{
  \begin{array}{lr}
    x^2 & : x < 0\\
    x^3 & : x \ge 0
  \end{array}
\right.
\]
또는
\[
 u(x) =
  \begin {cases}
   \exp{x} & \text{if } x \geq 0 \\
   1       & \text{if } x < 0
  \ end {cases}
\ ]

\[
 u(x) =
  \begin{cases}
   \exp{x} & \text{if } x \geq 0 \\
   1       & \text{if } x < 0
  \end{cases}
\]

2. Arc(호) 문자

\overset{{\frown}}{{ABC}} =$\overset{{\frown}}{{ABC}}$
3. HTML 원문자
&#9450;  = ⓪
&#9312; = ①
&#9413;= ②
&#9314; = ③
&#9315; = ④
&#9316; = ⑤
&#9317; = ⑥
&#9318; = ⑦
&#9319; = ⑧
&#9320; = ⑨
&#9321; = ⑩
참조(http://xahlee.info/comp/unicode_circled_numbers.html)
& # 8734; = ∞
& # 8242; =′
& #9696; = ◠

3. latex 원 문자

\textcircled{1} : mathjax에서는 작동하지 않는다. Sigil에서는 작동됩니다.
\textcircled{1}

4. 하나의 방정식을 여러 줄에 나타냄

\begin{equation}\label{xx} \begin{split} a&=b+c-d
\\ & +e-f
\\ & =g+h
\\ & =i
;\end{split} \end{equation}
\begin{equation}\label{xx} \begin{split} a&=b+c-d
\\ & +e-f
\\ & =g+h
\\ &=i \end{split} \end{equation}
위 식에서 "&"는 일정간격유지하기 위해 사용합니다.

5.  화살표 아래위의 문구 삽입

$a \xrightarrow [under ]{over}b$

6. "align" 또는 "align*"

다중행의 식을 작성하기 위해 사용합니다. "\\"는 개행, '&'는 행들이 정렬되어야 하는 위치를 지정하기 위해 사용합니다. (sigil에서는 &amp; 사용)
\begin{align}
 f(x) &= x^4 + 7x^3 + 2x^2 \nonumber \\
      &\qquad {} + 10x + 12
\end{align}
\begin{align} f(x) &= x^4 + 7x^3 + 2x^2 \nonumber \\ &\qquad {} + 10x + 12 \end{align}
\begin{align*}
 f(x)  &= a x^2+b x +c   &   g(x)  &= d x^3 \\
 f'(x) &= 2 a x +b       &   g'(x) &= 3 d x^2
\end{align*}
\begin{align*} f(x) &= a x^2+b x +c & g(x) &= d x^3 \\ f'(x) &= 2 a x +b & g'(x) &= 3 d x^2 \end{align*}

7. Box

\begin{equation}
 \boxed{x^2+y^2 = z^2}
\end{equation}
\begin{equation} \boxed{x^2+y^2 = z^2} \end{equation}

8. color and font size

\color{blue} {\displaystyle a^2=\textstyle b^2+\scriptstyle c^2  \scriptscriptstyle 3}
$$\color{blue} {\displaystyle a^2=\textstyle b^2+\scriptstyle c^2  \scriptscriptstyle 3}$$

댓글

이 블로그의 인기 게시물

[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...