보관물

‘Mathematics’ 카테고리의 보관물

vector

5월 25, 2011 댓글 남기기

dot product
\vec{A}\cdot\vec{B} = |A||B|\cos\theta
\begin{aligned}  \vec{A} \cdot\vec{B} & = \left( A_x \hat{x} + A_y \hat{y} \right)\left( B_x \hat{x} + B_y \hat{y} \right)\\  & = A_x \hat{x} B_x \hat{x} + A_y \hat{y} B_x \hat{x} + A_x \hat{x} B_y \hat{y} + A_y \hat{y} B_y \hat{y}\\  & = A_xB_x\hat{x}\hat{x} + A_yB_x\hat{y}\hat{x} + A_xB_y\hat{x}\hat{y} + A_yB_y\hat{y}\hat{y}\\  & = A_xB_x + A_yB_y  \end{aligned}
\because \hat{x}\hat{y} = 0, \hat{x}\hat{x} = 1

cross product
A \times B = |A||B|sin \theta
\begin{aligned}  A \times B & = \left( A_x\hat{x} + A_y\hat{y} + A_z\hat{z} \right) \times \left( B_x\hat{x} + B_y\hat{y} + B_z\hat{z} \right)\\  & = A_xB_x \hat{x}\hat{x} + A_yB_x\hat{y}\hat{x} + A_zB_x\hat{z}\hat{x} + A_xB_y\hat{x}\hat{y}+A_yB_y\hat{y}\hat{y} + A_zB_y\hat{z}\hat{y} + A_xB_z\hat{x}\hat{z} + A_yB_z\hat{y}\hat{z} + A_zB_z\hat{z}\hat{z}\\  & = ( A_yB_z - A_zB_y ) \hat{x}+( A_zB_x - A_xB_z) \hat{y}+ ( A_xB_y - A_yB_x ) \hat{z}  \end{aligned}

카테고리:Mathematics

Financial Numerical Recipes in C++

4월 5, 2010 댓글 남기기

Cumulative distribution function(CDF)

5월 29, 2009 댓글 남기기

정규분포의 수식은
\varphi_{\mu, \sigma^2}(x) = \frac{1}{\sigma\sqrt{2\pi}} \, e^{-\frac{(x-\mu)^2}{2\sigma^2}}
이렇게 표시되며 이를 표준정규분포의 수식은(μ = 0, σ = 1)
\varphi_{0, 1}(x) = \frac{1}{\sqrt{2\pi}} \, e^{\frac{-x^2}{2}}
이런식으로 표시된다.
이를 누적 정규분포로 만들어야 하는데, Cumulative distribution function(CDF)의 경우.
-∞에서 x까지의 적분으로 구해지는데..
\varphi_{\mu,\sigma^2}(x){}=\int_{-\infty}^x\varphi_{\mu,\sigma^2}(u)\, du {}=\frac{1}{\sigma\sqrt{2\pi}} \int_{-\infty}^x e^{-\frac{(u - \mu)^2}{2\sigma^2}}\, du
\varphi_{0,1}(x){}=\frac{1}{\sqrt{2\pi}} \int_{-\infty}^x e^{\frac{-u^2}{2}}\, du {}= \frac{1}{2} \left[ 1 + {erf} \left( \frac{x}{\sqrt{2}} \right) \right]

여기서erf란, 소위 error function(또는 Gauss error function) 라고 검색되었으며 이는.
{erf}(x) = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} \, dt
오른쪽 수식을 테일러 급수를 이용하여 전개하면
{erf}(x)=\frac{2}{\sqrt{\pi}} \left( x-\frac{x^3}{3}+\frac{x^5}{10}-\frac{x^7}{42}+\frac{x^9}{216}-\cdots \right)

이를 정리를 하면
{erf}(x)= \frac{1}{2}+\frac{1}{\sqrt{2\pi}}\left[x-\frac{x^3}{6}+\frac{x^5}{40}-\frac{x^7}{336}+\cdots+\frac{(-1)^rx^{2r+1}}{(2r+1)2^r(r!)}+\cdots\right]

0 < x ≤ 2에서 근사식을 유도하였는데
(Abramowitz and Stegun: Handbook of Mathemathical functions)
{erf}(x)=0.5+x(a+y[b+y(c+y[d+y(e+y[f+y(g+hy)])])])
a = 0.3989422784
b = -2.127690079
c = 10.2125662121
d = -28.8830314909
e = 120.2836370787
f = -303.2973153419
g = 575.073131917
h = -603.9068092058

이것을 -∞에서 ∞까지의 근사식으로 표현하면
{erf}(x)= \frac{1}{2}+\frac{1}{\sqrt{2\pi}}x e^{\frac{-x^2}{8}}\sum_{n=0}^{\infty}\frac{\theta_{2n}(\frac{x}{2})}{2n+1}

이것을 수식 형태로 변경하면.
y = 1/(1 + 0.2316419 * fabs(input)
z = 0.3989423 * exp(pow(input, 2) * -1 / 2);
x = 1 – z * (1.330274429 * pow(y, 5) – 1.821255978 * pow(y, 4) + 1.781477937 * pow(y, 3)
- 0.35653782 * pow(y, 2) + 0.31938153 * y);

이런식으로 표현이 됩니다

http://mathworld.wolfram.com/Erf.html

http://en.wikipedia.org/wiki/Error_function

http://en.wikipedia.org/wiki/Normal_distribution

C++ programs for Finance

카테고리:Mathematics

Normal distribution

1월 15, 2009 댓글 남기기
카테고리:Mathematics

Euler number

1월 15, 2009 댓글 남기기

자연상수는 오일러의 수 (Euler number) 라고 부르고 기호로는 e 로 나타낸고 자연로그의 밑이 되는 수이다.
이 수의 값은 대략 2.7182818284588… 등으로 나가는 무리수, 그것도 초월수(다항식의 근이 될수 없는 수)가 된다.
이 값은 지수함수 exp의 1에서의 함수값, 즉 exp(1)이고 극한으로 표시하면
e = \lim_{n\to\infty} \left(1+\frac{1}{n}\right)^n
이고 무한급수로 나타내면
e = \sum_{n=0}^\infty {1 \over n!} = {1 \over 0!} + {1 \over 1!} + {1 \over 2!} + {1 \over 3!} + {1 \over 4!} + \cdots

로 표현할수 있다.

카테고리:Mathematics
팔로우

모든 새 글을 수신함으로 전달 받으세요.