Skip to content

Latest commit

 

History

History
511 lines (432 loc) · 16.6 KB

Math.org

File metadata and controls

511 lines (432 loc) · 16.6 KB

Math

1 Statistic

1.1 Gauss distribution

标准高斯分布的积分包含了高斯积分

1.2 Co-variance matrix 协方差矩阵

<<covariance matrix link for ML>> for i = {1…n}, $xi$ is a random variable, which belong to Gaussian distribution

set $$ X = \left( \begin{aligned} x1 \ x2\ . \. \xn \end{aligned}\right) $$

$$ \bar{X} = \left( \begin{aligned} \bar{x}1 \ \bar{x}2\ . \. \ \bar{x}n \end{aligned} \right) $$ co-variance matrix $Σ = E [(X-\bar{X})(X-\bar{X})T ]$

\begin{equation} Σ = \left( \begin{array}{c} x1-\bar{x}1
x2-\bar{x}2 \ x3-\bar{x}3 \ .. \ xn-\bar{x}n \end{array} \right) \left( \begin{array}{ccccc} x1-\bar{x}1 & x2-\bar{x}2 & x3-\bar{x}3 & .. & xn-\bar{x}n \end{array} \right) \end{equation} 对角线上是对应元素的方差,其他是相对于两个元素的协方差 $←$

1.3 Maximun likelihood

according to the given example finding the most likely distribution model
1, assign each instance a probability to be happen
2, descripte the the probability of all such instance happens
3, logarithm the probability
4, partial derivative the logarithm
5, set the partial derivative to be 0, get the probability in 1 step

2 linear Argebra

2.1 Matrix

2.1.1 Graph

digraph diagramm {
TransposeMatrix -> orthogonalMatrix[label = "A^TA = AA^T = 1"];
TransposeMatrix -> SymmetryMatrix[label= "A=A^{T}"];
SymmetryMatrix  -> HermitianMatrix[label= "A=A^{H}"];
HermitianMatrix -> positivedefinitematrix;
ConjugatetransposeMatrix -> NormalMatrix[label = "A*A = AA*"];
NormalMatrix  -> UnitaryMatrix[label = "A*A = AA* =1"] ;

Einzelwertzerlegung -> Diagroal [label = "SVD"] ;
Eigenwertzerlegung -> Diagroal [label = "for real and symmetrisch"];
Diagroal ->  Unitaryzerlegung [label ="A=VIV*,I:identity"];

}

foto/Matrix_Connections.png

2.1.2 transpose Matrix

$AT$

2.1.3 symmetry conjugate

$$ AH$$ symmetry and complex conjugate matr

2.1.4 Symmetry Matrix

$$ A = AT$$

2.1.5 orthogonal matrix

实数酉矩阵 $$ {\displaystyle QT=Q-1⇔ QTQ=QQT=I}$$ 得该矩阵的转置矩阵为其逆矩阵

2.1.6 Hermitian matrix

A = symmetry conjugate of A (共轭对称) $$ A = AH$$, $ai,j = \bar{aj,i}$

埃尔米特矩阵,厄米特矩阵,厄米矩阵,所有元素对称出共轭

2.1.7 Conjugate transpose Matrix

$$ A* = (\bar{A})T = \bar{AT}$$ 共轭转置矩阵, 先共轭再转置,还是先转置再共轭都可以。

2.1.8 Normal Matrix

$$ AA = A A$$ 正定矩阵, 是转置和本身满足交换律 $$ A = URDU-1 $$ 可酉变换

2.1.9 Unitary Matrix

$$ AA = A A = I $$ 酉矩阵,是正定矩阵, 即转置和本身满足交换律,而且等于 I

2.1.10 Eigenwertzerlegung

对于矩阵求特征值特征向量,特征值分解,但是要求必须是方阵,如果不是,先 要转换: A = a*a.T

$$ A=UBU^T $$

import numpy as np
a = np.mat([[1,2,3,4],[1,1,1,1]])
A = a*a.T
B, U = np.linalg.eig(A)
print("eigenvalue of A : ")
print(B)
print("eigenvalue of a :(should be equal to the following) ")
print(np.sqrt(B))
print("eigenvactor : ")
print(U)

但是对于一般矩阵,不是方阵,可以奇异值分解: $$ a = UBV^T , at = VBUT $$ $$ A = aaT = UB2UT$$ $$ A=aTa=VB2VT$$

import numpy as np
a = np.mat([[1,2,3,4],[1,1,1,1]])
U, B, Vt = np.linalg.svd(a)
print("left eigenvalue : ")
print(U)
print("eigenvactor of a : ")
print(B)
print("right eigenvalue : ")
print(Vt)

2.2 Transform

2.2.1 Jacobin matrix

wikipedia chinese link englich link

for $$ Ym = f(Xn), Y =(y1, y2, y3....ym), X = (x1 ,x2....xn) $$ $$ dY = J dx$$, $$ {\displaystyle \mathbf {J} ={\begin{bmatrix}{\dfrac {∂ \mathbf {f} }{∂ x1}}&\cdots &{\dfrac {∂ \mathbf {f} }{∂ xn}}\end{bmatrix}}={\begin{bmatrix}{\dfrac {∂ f1}{∂ x1}}&\cdots &{\dfrac {∂ f1}{∂ xn}}\\vdots &\ddots &\vdots \{\dfrac {∂ fm}{∂ x1}}&\cdots &{\dfrac {∂ fm}{∂ xn}}\end{bmatrix}}} $$ 由球坐标系到直角坐标系的转化由 F: ℝ+ × [0, π] × [0, 2π) → ℝ3 函数给出, 其分量为: $$ {\displaystyle {\begin{aligned}x&=rsin θ cos \varphi ;\y&=rsin θ sin \varphi ;\z&=rcos θ .\end{aligned}}} $$ 此坐标变换的雅可比矩阵是 $$ {\displaystyle \mathbf {J} \mathbf {F }(r,θ ,\varphi )={\begin{bmatrix}{\dfrac {∂ x}{∂ r}}&{\dfrac {∂ x}{∂ θ }}&{\dfrac {∂ x}{∂ \varphi }}\[1em]{\dfrac {∂ y}{∂ r}}&{\dfrac {∂ y}{∂ θ }}&{\dfrac {∂ y}{∂ \varphi }}\[1em]{\dfrac {∂ z}{∂ r}}&{\dfrac {∂ z}{∂ θ }}&{\dfrac {∂ z}{∂ \varphi }}\end{bmatrix}}={\begin{bmatrix}sin θ cos \varphi &rcos θ cos \varphi &-rsin θ sin \varphi \sin θ sin \varphi &rcos θ sin \varphi &rsin θ cos \varphi \cos θ &-rsin θ &0\end{bmatrix}}.} $$ 其雅可比行列式为 r2 sin θ,由于 dV = dx dy dz,如果做变数变换的话其体 积元(Volume element),dV,会变成:dV = r2 sin θ dr dθ dφ。

3 Advanced Math Method

3.1 Fourier Problem

3.1.1 Fourier Series

任意周期函数都可以写成若干正余弦函数在不同频率的叠加, 假设目标函数为$f(t)$ so $f(t) = \frac{a0}{2}+∑n=0 ansin(nω t+φ_n)$

or $f(t) = \frac{a0}{2}+∑n=0 ansin(nω t) + ∑n=0 ancos(nω t)$

And There is series orthometric basis (1, $sin(n ω_t)$, $cos(n ω_t)$).

f(x) can also be wrote with complex form, $f(t) = ∑+∞k = -∞Ckeikx$, where $Ck = \frac{1}{2π}∫πf(x)e-ikxdx$

3.1.2 Fourier Transfromation

set $ω t = θ$, we use $eθ j = e ω t j = cos\theta + jsin\theta$ to multipy all terms in $f(x)$, which invokes factor $ω$.

SO $f(t) → F(ω) = ∫-∞+∞ f(t) e^{-j ω t}dt$ and its inverse transfromation: $F(ω) → f(t) = ∫-∞+∞F(ω)ejω t dω$

3.1.3 Laplace Transfromation

If $f(x)→ ∞ |x→\infty$ ,we can use $e-σ t$ to eliminate divergence.

Laplace transfromation : $f(t) → L(w) = ∫-∞f(t)e-σ te-jω t dt$

or $f(t)→ L(w) \int_{-\infty}^{\infty}f(w)e^{-st}dt$, where $sσ + j ω$

note: firstly force to convergence, then fourier transfromed.

3.1.4 Z-transform

$$ Xs(t) = ∑+∞k=-∞δ(t-kT)x(t)$$ where $x(t)$ is the extractly continue signal function, $δ(t-Kt)$ presents that we only measured at time Kt, $Xs(t)$ shows us all the measurements at time of…-2T, -T, 0, T, 2T, 3T…

The Fourier Transform of the measurements are $XF$, $$XF = ∫-∞-∞ δ(t-kT)x(t) e-jω t dt = ∑-∞x[kT]e-jwkT$$

for $Z =eiwT$, $XF = ∑x[k]Z-k$ , this is Z Transform aber $Ω = ω T$, $XF = ∑-∞ x[k]e-jΩ k$, this is Distinct Fourier Transform

3.1.5 Distinct Fourier Transform

for $f(t) = ∑+∞k = -∞Ckeikx$, where $Ck = \frac{1}{2π}∫πf(x)e-ikxdx$, we only consider that, f(x) only has N items, from k=0, to N-1, $$f(x) = C0 + C1eix+Ci2x+Ci3x+.....+CN-1ei(N-1)x$$ and we has exactly N measurements points, $f0, f1....fN-1$, and we image that those N points is exactly in a period,which is from 0 to $2π$, so… set $w = e\frac{2iπ{N}}$ $$f(0\frac{2π}{N} ) = C0 + C1 + C2+…+CN-1$$ $$f(1\frac{2π}{N} ) = C0 + C1w + C2w2+…+CN-1wN-1$$ $$f(2\frac{2π}{N} ) = C0 + C1w2 + C2w4+…+CN-1w2(N-1)$$ $$f(3\frac{2π}{N} ) = C0 + C1w3 + C2w6+…+CN-1w3(N-1)$$ $$f((N-1)\frac{2π}{N} ) = C0 + C1wN-1 + C2w2(N-1)+…+CN-1w(N-1)(N-1)$$ Here it is

\begin{equation} \left( \begin{array}{c} f0
f1 \ f2 \ ....\ fN \end{array} \right) = \left( \begin{array}{ccccc} 1 & 1 & 1 & …& 1\ 1 & w & w2 & …& wN-1\ 1 & w2 & w4 & …& w2(N-1)\ …&…&…&…&…\ 1 & wN-1 & w2(N-1) & …& w(N-1)(N-1)\ \end{array} \right) \left( \begin{array}{c} C0 \ C1 \ C2 \ ....\ CN \end{array} \right) \end{equation} We can have exactly all coefficient of C.

if we have only N measurements, but we want to have a general solution for all possible items of f(t), for $f(t) = ∑+∞k = -∞Ckeikx$,

\begin{equation} \left( \begin{array}{c} f0
f1 \ f2 \ ....\ fN \end{array} \right) = \left[ \begin{array}{ccccc} 1 & 1 & 1 & …& 1\ 1 & w & w2 & …& wN-1\ 1 & w2 & w4 & …& w2(N-1)\ …&…&…&…&…\ 1 & wN-1 & w2(N-1) & …& w(N-1)(N-1)\ \end{array} \right] \left( \begin{array}{c} …+C-N + C0+CN+… \ …+C-N+1+ C1+CN+1+… \ …+C-N+2+ C2+CN+2+… \ …\ …+C-1+ CN-1+C2N-1 +… \end{array} \right) \end{equation}

All possible solutions can be satisfied. denote matrix $w$ as Fourier Matrix: F, $$X = FC$$ , $$C = F-1X$$

3.1.6 Fast Fourier Transform

we here only consider about $F-1$, so denote it as $F$,

\begin{equation} F4 = \left[ \begin{array}{cccc} 1 & 1 & 1 & 1
1 & w & w2 & w3\ 1 & w2 & w4& w6)\ 1 & w3 & w6& w9\ \end{array} \right] \end{equation}

\begin{equation} \bar{F}4 = \left[ \begin{array}{cccc} 1 & 1 & 1 & 1
1 & w2 & w & w3\ 1 & w4 & w2& w6)\ 1 & w6 & w3& w9\ \end{array} \right] = \left[ \begin{array}{cc} F2 & D2F2\ F2 & -D2F2 \end{array} \right] \end{equation}

$$X = \begin{bmatrix} f0 \ f1 \....\fN-1 \end{bmatrix}$$

$$FNX = \bar{F}N\begin{bmatrix} f0 \ f2 \f4\…\fN-2 \ f1 \ f3\f5\…\fN-1 \end{bmatrix} =\begin{bmatrix} FN/2 & DN/2FN/2 \ FN/2 & -DN/2FN/2 \end{bmatrix} \begin{bmatrix} f0 \ f2 \f4\…\fN-2 \ f1 \ f3\f5\…\fN-1 \end{bmatrix} = \begin{bmatrix} I & DN/2 \ I & -DN/2 \end{bmatrix} \begin{bmatrix} FN/2 & \ & FN/2 \end{bmatrix} \begin{bmatrix} Xeven \ Xodd \end{bmatrix} $$

$$FNX = \begin{bmatrix} I & DN/2 \ I & -DN/2 \end{bmatrix} \begin{bmatrix} FN/2 Xeven \ FN/2Xodd \end{bmatrix} $$

always recursive to $D_2$, that is

3.2 Convolution law

Green function propagate function segment $$ f(x) $$ $$ f(x) = ∫-∞ f(t)δ(x-t)dt $$

convolution $$ (g ∗ f)(x) = ∫-∞f(t)g(x-t)dt $$

3.3 Kalman Filter

3.3.1 descripation

For a continus system we can estimate the next predict state based on current optimized (best, precise) state and its uncertainies. if there is next observe state, we can combine them to a next optimized state and get its uncertainies, and ready for next iterative.

Estimatation Function:

$$Xk = FXk-1 + B μk + ωk$$

$X$ stands for the state, with $n× a$ $F$ stands for the state Operator with $n× n$ $B$ stands for contoller operator $ω$ is the current system uncertainies and $Cov(ω) = Q$ with $n × n$

Revise Function: $$Zk = HXk + νk$$

$Z$ stands for the observe state, with $a× a$ $H$ stands for Observe Operator with $a × n$ $ν$ is the observation uncertainies and $Cov(ν) = R$ with $a × a$ H = $$ \frac{H}{∂ x1}$$, $$ \frac{H}{∂ x2}$$, $$ \frac{H}{∂ v}$$, $$ \frac{H}{∂ α}$$,

3.3.2 kalman filter process

assumpation: we know current state $Xk$, and its uncertainies $Σk$

  1. estimatation

$$Xk+1p = F Xk $$ $$ Σpk+1 = F ΣkFT + Qk$$ $Σkp, Σk+1p, Qk$ all with $n × n$

2, kalman filter calcaletation $$KF = \frac{ ΣkpHT} {(H ΣkpHT + Rk)}$$ with $n × a$: because Numerator has $n × a$ and denominator has $a × a$

3, Revise resulte $$Xk+1 = Xk+1p + KF(Zk -HXk+1p)$$

$$Σk+1 = (I-KF * H) Σk+1p$$

3.3.3 python code

# _*_ coding:utf-8 _*_
import numpy as np
import matplotlib.pyplot as plt

# 创建一个0-99的一维矩阵
z = [i for i in range(100)]
z_watch = np.mat(z)
#print(np.array(z).shape)
#print(np.array(z_watch).shape)

# 创建一个方差为1的高斯噪声,精确到小数点后两位
noise = np.round(np.random.normal(0, 1, 100), 2)
noise_mat = np.mat(noise)
# print(noise_mat)

# 将z的观测值和噪声相加
z_mat = z_watch + noise_mat
#print(z_mat)

# 定义x的初始状态
x_mat = np.mat([[0, ], [0, ]])
# print(x_mat)
# 定义初始状态协方差矩阵
p_mat = np.mat([[1, 0], [0, 1]])
# 定义状态转移矩阵,因为每秒钟采一次样,所以delta_t = 1
f_mat = np.mat([[1, 1], [0, 1]])
# 定义状态转移协方差矩阵,这里我们把协方差设置的很小,因为觉得状态转移矩阵准确度高
q_mat = np.mat([[0.0001, 0], [0, 0.0001]])
# 定义观测矩阵
h_mat = np.mat([1, 0])
# 定义观测噪声协方差
r_mat = np.mat([1])

for i in range(100):
    x_predict = f_mat * x_mat
    p_predict = f_mat * p_mat * f_mat.T + q_mat
    kalman = p_predict * h_mat.T / (h_mat * p_predict * h_mat.T + r_mat)
    x_mat = x_predict + kalman * (z_mat[0, i] - h_mat * x_predict)
    p_mat = (np.eye(2) - kalman * h_mat) * p_predict
    plt.plot(x_mat[0, 0], x_mat[1, 0], 'ro', markersize=1)
plt.show()

3.4 Grope Theorie

3.4.1 sammlungen von Grope

  1. G本身和单位元称为G的平凡子集
  2. 群的元素个数称为群的阶
  3. 群的阶数是素数,则该群一定是循环群
  4. 有限群的子集的阶数是该有限群的阶数的约数
  5. 在置换群中,任何一个轮换都可以用其他的对换组合来实现
  6. 在置换群中,如果一个置换能通过奇(偶)数次对换得到,那么它只能有奇 (偶)数次对换得到
  7. 在一个置换群中,可以奇置换和偶置换的个数应给相等
  8. 由偶置换可以得到一个交错群(包括与单元群的置换)
  9. 阿贝尔群
  10. $β_1 × H$ 元素$β_1$ 左乘H的每一个元素得到的就叫: 元素 $β_1$ 关于H的左陪集
  11. 右陪集亦然, 左右陪集可以不相等
  12. 子群H中每个元素作用于群G,得到的左右陪集都相等,则称H为G的正规子群
  13. G本身和单位元{e}肯定都是正规子集,但是成为平凡正规子群
  14. 只有群中有正规子集,这该群中肯定存在一个相应的对称
  15. 阿贝尔群的子群肯定是正规子群
  16. 只有当H是正规子群是,商群G/H才是一个群,否则只是一个空间
  17. 单群,没有正规子群的群,是群论中的最小单元