CQF笔记Primer数学基础

CQF笔记Primer数学基础

1 Calculus 微积分

1.1 Basic Terminology 基本术语

符号含义符号含义符号含义
∃ \exists 存在 → \rightarrow 给定 ≡ \equiv 等价于
∀ \forall 对所有……有s.t.such that ∼ \sim similar
∴ \therefore 所以:such that ∈ \in 是……的元素
∵ \because 因为iff当且仅当!x有唯一的x

1.2 Functions 函数

输入到输出的映射 mapping:

  • input记作x,independent variable,自变量
  • output记作y,dependent variable,因变量

mapping 映射:

  • 一对一
  • 多对一
  • 一对多(不是函数)

函数的定义:每个x映射到唯一的一个y

inverse function 逆函数

  • 一对一映射的函数有反函数
  • 多对一映射的函数没有反函数,限制自变量的值域,变成一对一映射

函数 y = 2 x 2 − 1 y = 2x^2 - 1 y=2x21的逆函数(限制x的取值范围为 x ≥ 0 x \ge 0 x0)为
y = x + 1 2 y = \sqrt{\frac{x+1}{2}} y=2x+1

f ( f − 1 ( x ) ) = x f(f^{-1}(x)) = x f(f1(x))=x
f − 1 ( f ( x ) ) = x f^{-1}(f(x)) = x f1(f(x))=x

even function偶函数和 odd function 奇函数

偶函数

  • f ( − x ) = f ( x ) f(-x) = f(x) f(x)=f(x)
  • 沿y轴对称

奇函数

  • f ( − x ) = f ( − x ) f(-x) = f(-x) f(x)=f(x)
  • 中心对称(沿原点旋转180°)

大部分函数不是偶函数或者奇函数,但是可以表达为奇函数和偶函数之和

1.2.1 Explicit/Implicit Representation 显示/隐式表示

显示表示 y = 2 x 2 + 4 x − 16 = 0 y = 2x^2 + 4x - 16 = 0 y=2x2+4x16=0
隐式表示 f ( x , y ) = 0 f(x,y) = 0 f(x,y)=0

1.2.2 Types of function
Polynomials 多项式

f ( x ) = ∑ k = 0 n a k x k ,   其 中 a 0 , a 1 , . . . , a n 是 常 数 f(x) = \sum_{k=0}^{n} a_k x^k, \ 其中a_0, a_1, ..., a_n是常数 f(x)=k=0nakxk, a0,a1,...,an

  • K = 1称为线性项
  • K = 2称为二次项

二次多项式 a x 2 + b x + c = 0 ax^2 + bx + c = 0 ax2+bx+c=0 的解
x = − b ± b 2 − 4 a c 2 a x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} x=2ab±b24ac

三种情况:

  • b 2 − 4 a c > 0 → x 1 ≠ x 2 , 两 个 实 数 根 b^2 - 4ac > 0 \rightarrow x_1 \neq x_2,两个实数根 b24ac>0x1=x2
  • b 2 − 4 a c = 0 → x 1 = x 2 = − b 2 a 为 实 数 b^2 - 4ac = 0 \rightarrow x_1 = x_2 = - \frac{b}{2a} 为实数 b24ac=0x1=x2=2ab
  • b 2 − 4 a c < 0 → x 1 ≠ x 2 , 两 个 复 数 共 轭 根 b^2 - 4ac < 0 \rightarrow x_1 \neq x_2,两个复数共轭根 b24ac<0x1=x2
Modulus 模(绝对值)

f ( x ) = { x x>0 − x x<0 f(x)= \begin{cases} x& \text{x>0}\\ -x& \text{x<0} \end{cases} f(x)={xxx>0x<0

模函数是分段函数piecewise function

1.3 Limit 极限

研究逼近问题

lim ⁡ x → x 0 f ( x ) → l \lim_{x \to x_0} f(x) \rightarrow l xx0limf(x)l

同时从左边逼近和从右边逼近,应该相同逼近同一个值

普通极限

lim ⁡ x → ∞ x 2 + 2 x + 2 3 x 2 + 4 = lim ⁡ x → ∞ 1 + 2 x + 2 x 2 3 + 4 x 2 = 1 3 \begin{aligned} & \lim_{x \to \infty} \frac{x^2 + 2x + 2}{3x^2 + 4} \\ = & \lim_{x \to \infty} \frac{1 + \frac{2}{x} + \frac{2}{x^2}}{3 + \frac{4}{x^2}} \\ = & \frac{1}{3} \end{aligned} ==xlim3x2+4x2+2x+2xlim3+x241+x2+x2231

函数连续

lim ⁡ x → x 0 f ( x ) = f ( x 0 ) \lim_{x \to x_0} f(x) = f(x_0) xx0limf(x)=f(x0)

1.3.1 exponential and log functions 指数和对数函数

y = a x y = log ⁡ a x y = a^x \\ y = \log_a x y=axy=logax

以自然对数为底的指数函数和对数函数
y = e x y = l n   x y = l o g   x y = e^x \\ y = ln\ x \\ y = log\ x y=exy=ln xy=log x

e = lim ⁡ n → ∞ ( 1 + x n ) n e = \lim_{n \to \infty} (1 + \frac{x}{n})^n e=nlim(1+nx)n

正态分布的形式类似于 e − x 2 / 2 e^{-x^2 / 2} ex2/2

1.3.2 Trigonometric/Circular Functions 三角函数

sin 正弦函数

  • 奇函数 s i n ( − x ) = − s i n ( x ) sin(-x) = -sin(x) sin(x)=sin(x)
  • 周期函数 s i n ( x + 2 π ) = s i n ( x ) sin(x + 2 \pi) = sin(x) sin(x+2π)=sin(x)
  • s i n x = 0 ⇔ x = n π   ∀ n ∈ Z sinx = 0 \Leftrightarrow x = n \pi \ \forall n \in Z sinx=0x=nπ nZ
  • D o m ( s i n x ) = R Dom(sinx) = R Dom(sinx)=R and I m ( s i n x ) = [ − 1 , 1 ] Im(sinx) = [-1, 1] Im(sinx)=[1,1]

cos 余弦函数

  • 偶函数 c o s ( − x ) = c o s ( x ) cos(-x) = cos(x) cos(x)=cos(x)
  • 周期函数 c o s ( x + 2 π ) = c o s ( x ) cos(x + 2 \pi) = cos(x) cos(x+2π)=cos(x)
  • c o s = 0 ⇔ x = ( 2 n + 1 ) π 2   ∀ n ∈ Z cos= 0 \Leftrightarrow x = (2n + 1) \frac{\pi}{2} \ \forall n \in Z cos=0x=(2n+1)2π nZ
  • D o m ( c o s   x ) = R Dom(cos\ x) = R Dom(cos x)=R and I m ( c o s   x ) = [ − 1 , 1 ] Im(cos \ x) = [-1, 1] Im(cos x)=[1,1]

tan 正切函数

  • 偶函数 t a n ( − x ) = t a n ( x ) tan (-x) = tan (x) tan(x)=tan(x)
  • 周期函数 c o s ( x + π ) = c o s ( x ) cos(x + \pi) = cos(x) cos(x+π)=cos(x)
  • D o m ( t a n   x ) = { x : c o s   x ≠ 0 } = { x : x ≠ ( 2 n + 1 ) π 2 ;   ( n ∈ Z ) } = R − { x = ( 2 n + 1 ) π 2 ;   ( n ∈ Z ) } Dom(tan\ x) = \{x : cos \ x \neq 0\} = \{x : x \neq (2n + 1) \frac{\pi}{2}; \ (n \in Z) \} = R - \{x = (2n + 1) \frac{\pi}{2}; \ (n \in Z) \} Dom(tan x)={x:cos x=0}={x:x=(2n+1)2π; (nZ)}=R{x=(2n+1)2π; (nZ)}

三角函数关系式
c o s 2 x + s i n 2 x = 1 cos^2 x + sin^2 x = 1 \\ cos2x+sin2x=1

s i n ( x ± y ) = s i n x   c o s y ∓ c o s x   s i n y c o s ( x ± y ) = c o s x   c o s y ∓ s i n x   s i n y t a n ( x ± y ) = t a n x ± t a n y 1 ∓ t a n x   t a n y sin(x \pm y) = sinx \ cosy \mp cosx \ siny \\ cos(x \pm y) = cosx \ cosy \mp sinx \ siny \\ tan(x \pm y) = \frac{tanx \pm tany}{1 \mp tanx \ tany} \\ sin(x±y)=sinx cosycosx sinycos(x±y)=cosx cosysinx sinytan(x±y)=1tanx tanytanx±tany

s e c x = 1 c o s x c s c x = 1 s i n x c o t x = 1 t a n x secx = \frac {1} {cosx} \\ cscx = \frac {1} {sinx} \\ cotx = \frac {1} {tanx} \\ secx=cosx1cscx=sinx1cotx=tanx1

s i n − 1 x → a r c s i n ( x ) c o s − 1 x → a r c c o s ( x ) t a n − 1 x → a r c t a n ( x ) sin^{-1}x \rightarrow arcsin(x) \\ cos^{-1}x \rightarrow arccos(x) \\ tan^{-1}x \rightarrow arctan(x) \\ sin1xarcsin(x)cos1xarccos(x)tan1xarctan(x)

lim ⁡ x → 0 s i n x = 0 lim ⁡ x → 0 s i n x x = 1 lim ⁡ x → 0 ∣ x ∣ = 0 lim ⁡ x → 0 ∣ x ∣ x 的 左 右 极 限 分 别 为 − 1 和 1 , 因 此 没 有 极 限 \lim_{x \to 0} sinx = 0 \\ \lim_{x \to 0} \frac{sinx}{x} = 1 \\ \lim_{x \to 0} |x| = 0 \\ \lim_{x \to 0} \frac{|x|}{x} 的左右极限分别为-1和1,因此没有极限 \\ x0limsinx=0x0limxsinx=1x0limx=0x0limxx11

1.3.3 Hyperbolic Functions 双曲函数

s i n h   x = 1 2 ( e x − e − x ) sinh \ x = \frac{1}{2}(e^x-e^{-x}) sinh x=21(exex)

  • 奇函数
  • D o m ( s i n h   x ) = R Dom(sinh \ x) = R Dom(sinh x)=R and I m ( s i n h   x ) = R Im(sinh \ x) = R Im(sinh x)=R

c o s h   x = 1 2 ( e x + e − x ) cosh \ x = \frac{1}{2}(e^x+e^{-x}) cosh x=21(ex+ex)

  • 偶函数
  • D o m ( c o s h   x ) = R Dom(cosh\ x) = R Dom(cosh x)=R and I m ( c o s h   x ) = [ 1 , ∞ ) Im(cosh\ x) = [1, \infty) Im(cosh x)=[1,)

t a n h   x = s i n h x c o s h x tanh \ x = \frac{sinhx}{coshx} tanh x=coshxsinhx

  • 奇函数
  • D o m ( c o s h   x ) = R Dom(cosh\ x) = R Dom(cosh x)=R and I m ( c o s h   x ) = ( 1 , 1 ) Im(cosh\ x) = (1, 1) Im(cosh x)=(1,1)

关系式

c o s h 2 x − s i n h 2 x = 1 s i n h ( x ± y ) = s i n h x   c o s h y ± s i n h x   c o s h y c o n s h ( x ± y ) = c o s h x   c o s h y ± s i n h x   s i n h y \begin{aligned} cosh^2 x - sinh^2 x & = 1\\ sinh(x \pm y) & = sinhx \ coshy \pm sinhx \ coshy \\ consh(x \pm y) & = coshx \ coshy \pm sinhx \ sinhy \\ \end{aligned} cosh2xsinh2xsinh(x±y)consh(x±y)=1=sinhx coshy±sinhx coshy=coshx coshy±sinhx sinhy

反函数

s i n h − 1 x = l n ∣ x + x 2 + 1 ∣ c o s h − 1 x = l n ∣ x + x 2 − 1 ∣ t a n h − 1 x = 1 2 l n ∣ 1 + x 1 − x ∣ \begin{aligned} sinh^{-1}x & = ln \left| x + \sqrt {x^2 + 1} \right| \\ cosh^{-1}x & = ln \left| x + \sqrt {x^2 - 1} \right| \\ tanh^{-1}x & = \frac{1}{2} ln \left| \frac{1+x}{1-x} \right| \\ \end{aligned} sinh1xcosh1xtanh1x=lnx+x2+1 =lnx+x21 =21ln1x1+x

1.4 Differentiation 微分

  • 莱布尼兹表示
    d f d x \frac{df}{dx} dxdf
  • 格朗日表示
    f ′ ( x ) f'(x) f(x)

定义

f ′ ( x ) = lim ⁡ δ x → 0 f ( x + δ x ) − f ( x ) δ x f'(x) = \lim_{\delta x \to 0} \frac{f(x + \delta x) - f(x)}{\delta x} f(x)=δx0limδxf(x+δx)f(x)

上述定义式为前向微分

  • 反向微分
    f ′ ( x ) = lim ⁡ δ x → 0 f ( x ) − f ( x − δ x ) δ x f'(x) = \lim_{\delta x \to 0} \frac{f(x) - f(x - \delta x)}{\delta x} f(x)=δx0limδxf(x)f(xδx)
  • 中心微分
    f ′ ( x ) = lim ⁡ δ x → 0 f ( x + δ x ) − f ( x − δ x ) 2 δ x f'(x) = \lim_{\delta x \to 0} \frac{f(x + \delta x) - f(x - \delta x)}{2 \delta x} f(x)=δx0lim2δxf(x+δx)f(xδx)

求微分的例子: f ( x ) = x 3 f(x) = x^3 f(x)=x3

f ′ ( x ) = lim ⁡ δ x → 0 f ( x + δ x ) − f ( x ) δ x = lim ⁡ δ x → 0 ( x + δ x ) 3 − x 3 δ x = lim ⁡ δ x → 0 ( x 3 + 3 x 2 δ x + 3 x δ x 2 + δ x 3 ) − x 3 δ x = lim ⁡ δ x → 0 ( 3 x 2 + 3 x δ x + δ x 2 ) = 3 x 2 \begin{aligned} f'(x) & = \lim_{\delta x \to 0} \frac{f(x + \delta x) - f(x)}{\delta x} \\ & = \lim_{\delta x \to 0} \frac{(x + \delta x)^3 - x^3}{\delta x} \\ & = \lim_{\delta x \to 0} \frac{(x^3 + 3 x^2 \delta x + 3x \delta x ^ 2 + \delta x ^ 3) - x^3}{\delta x} \\ & = \lim_{\delta x \to 0} (3x^2 + 3x\delta x + \delta x ^2) \\ & = 3x^2 \\ \end{aligned} f(x)=δx0limδxf(x+δx)f(x)=δx0limδx(x+δx)3x3=δx0limδx(x3+3x2δx+3xδx2+δx3)x3=δx0lim(3x2+3xδx+δx2)=3x2

常用微分

d d x x n = n x n − 1 d d x e x = e x d d x e a x = a e a x d d x l o g x = 1 x d d x s i n x = c o s x d d x c o s x = − s i n x d d x t a n x = s e c 2 x \frac{d}{dx} x^n = nx^{n-1} \\ \frac{d}{dx} e^x = e^x \\ \frac{d}{dx} e^{ax} = ae^{ax} \\ \frac{d}{dx} logx = \frac{1}{x} \\ \frac{d}{dx} sinx = cosx \\ \frac{d}{dx} cosx = -sinx \\ \frac{d}{dx} tanx = sec^2 x \\ dxdxn=nxn1dxdex=exdxdeax=aeaxdxdlogx=x1dxdsinx=cosxdxdcosx=sinxdxdtanx=sec2x

Linearity 线性:

线性的定义

  • O p ( c × f ( x ) = c × O p ( f ( x ) ) Op(c \times f(x) = c \times Op(f(x)) Op(c×f(x)=c×Op(f(x))
  • O p ( f ( x ) ± g ( x ) ) = O p ( f ( x ) ) ± O p ( g ( x ) ) Op(f(x) \pm g(x)) = Op(f(x)) \pm Op(g(x)) Op(f(x)±g(x))=Op(f(x))±Op(g(x))

两个函数加权和的微分,等于两个函数微分的加权和
y = λ f ( x ) + μ g ( x ) , λ 和 μ 是 常 量 d y d x = d d x ( λ f ( x ) + μ g ( x ) ) = λ f ′ ( x ) + μ g ′ ( x ) y = \lambda f(x) + \mu g(x), \lambda和\mu是常量 \\ \frac{dy}{dx}=\frac{d}{dx} ( \lambda f(x) + \mu g(x))= \lambda f'(x) + \mu g'(x) y=λf(x)+μg(x),λμdxdy=dxd(λf(x)+μg(x))=λf(x)+μg(x)

1.4.1 Product Rule 乘法法则

对两个函数的乘积求导数

y = f ( x ) × g ( x ) ⟹ d y d x = f ′ ( x ) × g ( x ) + f ( x ) × g ′ ( x ) y = f(x) \times g(x) \Longrightarrow \frac{dy}{dx} = f'(x) \times g(x) + f(x) \times g'(x) y=f(x)×g(x)dxdy=f(x)×g(x)+f(x)×g(x)

1.4.2 Function of a Function Rule 函数的函数法则

求函数的函数的导数:chain rule 链式求导法则

y = f ( g ( x ) ) ⟹ d y d x = f ′ ( g ( x ) ) × g ′ ( x ) y = f(g(x)) \Longrightarrow \frac{dy}{dx} = f'(g(x)) \times g'(x) y=f(g(x))dxdy=f(g(x))×g(x)

d y d x = d y d u × d u d x \frac{dy}{dx} = \frac{dy}{du} \times \frac{du}{dx} dxdy=dudy×dxdu

1.4.3 Quotient Rule 商数法则

可以用乘法法则推导

f ( x ) g ( x ) ⟹ d y d x = f ′ ( x ) × g ( x ) − f ( x ) × g ′ ( x ) ( ( g ( x ) ) 2 \frac{f(x)}{g(x)} \Longrightarrow \frac{dy}{dx} = \frac{f'(x) \times g(x) - f(x) \times g'(x)}{((g(x))^2} g(x)f(x)dxdy=((g(x))2f(x)×g(x)f(x)×g(x)

1.4.4 Implicit Differentiation 隐式微分

y = a x l n y = x l n   a 1 y d y d x = l n   a d y d x = a x l n   a y = a^x \\ lny = xln \ a \\ \frac{1}{y} \frac{dy}{dx} = ln \ a \\ \frac{dy}{dx} = a^x ln \ a y=axlny=xln ay1dxdy=ln adxdy=axln a

1.4.5 Higher Derivatives 高阶导数
  • n次多项式的 n+1 阶导数为0
  • 不是所有函数都处处可导
1.4.6 Leibniz Rule 莱布尼兹法则

乘法法则的高阶表示(二项式)
D n ( u v ) = ∑ i = 0 n C n i × D i u × D n − i v ,   C n r = n ! r ! ( ( n − r ) ! D^n(uv) = \sum_{i=0}^{n} C_n^i \times D^i u \times D^{n-i}v, \ C_n^r = \frac{n!}{r!((n-r)!} Dn(uv)=i=0nCni×Diu×Dniv, Cnr=r!((nr)!n!

1.4.7 Further Limits 高阶极限

L’Hospital’s rule

lim ⁡ x → a f ( x g ( x ) ≡ 0 0   o r   ∞ ∞ \lim_{x \to a} \frac{f(x}{g(x)} \equiv \frac{0}{0} \ or \ \frac{\infty}{\infty} xalimg(x)f(x00 or 
对极限的上下两部分同时求导,计算极限

lim ⁡ x → a f ( x g ( x ) = lim ⁡ x → a f ′ ( x g ′ ( x ) = … = lim ⁡ x → a f ( r ) ( x g ( r ) ( x ) \lim_{x \to a} \frac{f(x}{g(x)} = \lim_{x \to a} \frac{f'(x}{g'(x)} = … = \lim_{x \to a} \frac{f^{(r)}(x}{g^{(r)}(x)} xalimg(x)f(x=xalimg(x)f(x==xalimg(r)(x)f(r)(x

lim ⁡ x → 0 s i n x x = lim ⁡ x → 0 c o s x 1 = 1 \lim_{x \to 0} \frac{sinx}{x} = \lim_{x \to 0} \frac{cosx}{1} =1 \\ x0limxsinx=x0lim1cosx=1

1.5 Taylor Series 泰勒级数

多项式函数逼近原始函数,N次项的系数为N次导数

对于 f ( x ) = e x f(x)=e^x f(x)=ex, f ( r ) ( x ) = e x f^{(r)}(x) = e^x f(r)(x)=ex, f ( r ) ( 0 ) = 1 f^{(r)}(0) = 1 f(r)(0)=1

线性近似
截距项为1,斜率为1, e x ≈ 1 + x e^x \approx 1 + x ex1+x

二次近似
g ( x ) = a x 2 + b x + c g ′ ( x ) = 2 a x + b g ′ ′ ( x ) = 2 a g(x)=ax^2+bx+c \\ g'(x)=2ax+b \\ g''(x)=2a g(x)=ax2+bx+cg(x)=2ax+bg(x)=2a
g ( 0 ) = f ( 0 ) , g ′ ( 0 ) = f ′ ( 0 ) , g ′ ′ ( 0 ) = f ′ ′ ( 0 ) g(0)=f(0), g'(0)=f'(0), g''(0)=f''(0) g(0)=f(0),g(0)=f(0),g(0)=f(0)
得到 c = 1 , b = 1 , a = 1 2 c = 1, b = 1, a=\frac{1}{2} c=1,b=1,a=21
因此 e x ≈ 1 + x + 1 2 x 2 e^x \approx 1 + x + \frac{1}{2} x^2 ex1+x+21x2

三次近似: e x ≈ 1 + x + 1 2 x 2 + 1 6 x 3 e^x \approx 1 + x + \frac{1}{2} x^2 + \frac{1}{6} x^3 ex1+x+21x2+61x3

无穷展开 e x = ∑ n = 0 ∞ x n n ! e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} ex=n=0n!xn

泰勒级数: f ( x ) f(x) f(x) x 0 x_0 x0的泰勒展开
f ( x ) = ∑ n = 0 ∞ 1 n ! f ( n ) ( x 0 )   ( x − x 0 ) n f(x) = \sum_{n=0}^{\infty} \frac{1}{n!} f^{(n)}(x_0) \ (x-x_0)^n f(x)=n=0n!1f(n)(x0) (xx0)n

常用展开
e x = ∑ n = 0 ∞ x n n ! l o g ( 1 + x ) = ∑ n = 0 ∞ ( − 1 ) n − 1 x n n ! e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} \\ log(1+x)= \sum_{n=0}^{\infty} (-1)^{n-1} \frac{x^n}{n!} \\ ex=n=0n!xnlog(1+x)=n=0(1)n1n!xn

泰勒定量

f ( x ) = ∑ k = 0 n − 1 1 k ! f ( k ) ( x 0 )   ( x − x 0 ) k + R n ( x ) 其 中 R n ( x ) = 1 n !   f ( n ) ( ξ )   ( x − x 0 ) n ξ 是 介 于 x 0 和 x 之 间 的 某 个 未 知 数 值 \begin{aligned} & f(x) = \sum_{k=0}^{n-1} \frac{1}{k!} f^{(k)}(x_0) \ (x-x_0)^k + R_n(x) \\ 其中 & R_n(x) = \frac{1}{n!} \ f^{(n)}(\xi) \ (x-x_0)^n \\ & \xi是介于x_0和x之间的某个未知数值 \end{aligned} f(x)=k=0n1k!1f(k)(x0) (xx0)k+Rn(x)Rn(x)=n!1 f(n)(ξ) (xx0)nξx0x

用泰勒展开式计算极限
lim ⁡ x → 0 s i n   x x ∼ lim ⁡ x → 0 ∑ i = 0 ∞ ( − 1 ) i x 2 i + 1 ( 2 i + 1 ) ! x ∼ lim ⁡ x → 0 ∑ i = 0 ∞ ( − 1 ) i x 2 i ( 2 i + 1 ) ! ∼ lim ⁡ x → 0 ( 1 − x 2 3 ! + x 4 5 ! + … ) = 1 \begin{aligned} \lim_{x \to 0} \frac{sin \ x}{x} & \sim \lim_{x \to 0} \frac{\sum_{i=0}^{\infty} (-1)^{i} \frac{x^{2i+1}}{(2i+1)!}}{x} \\ & \sim \lim_{x \to 0} \sum_{i=0}^{\infty} (-1)^{i} \frac{x^{2i}}{(2i+1)!} \\ & \sim \lim_{x \to 0} (1 - \frac{x^2}{3!} + \frac{x^4}{5!} + …) \\ & = 1 \end{aligned} x0limxsin xx0limxi=0(1)i(2i+1)!x2i+1x0limi=0(1)i(2i+1)!x2ix0lim(13!x2+5!x4+)=1

1.5.1 The Binomial Expansion 二项式展开

二项式展开是 ( 1 + x ) n (1+x)^n (1+x)n的泰勒展开式

( 1 + x ) n = ∑ k = 0 n n ! k !   ( n − k ) ! x k ( 1 + a x ) n = ∑ k = 0 n n ! k !   ( n − k ) ! ( a x ) k ( p + a x ) n = ( p ( 1 + a p x ) ) n = p n ∑ k = 0 n n ! k !   ( n − k ) ! ( a p x ) k \begin{aligned} (1+x)^n & = \sum_{k=0}^n \frac{n!}{k! \ (n-k)!} x^k \\ (1+ax)^n & = \sum_{k=0}^n \frac{n!}{k! \ (n-k)!} (ax)^k \\ (p+ax)^n &= (p(1 + \frac{a}{p}x))^n\\ & = p^n \sum_{k=0}^n \frac{n!}{k! \ (n-k)!} (\frac{a}{p}x)^k\\ \end{aligned} (1+x)n(1+ax)n(p+ax)n=k=0nk! (nk)!n!xk=k=0nk! (nk)!n!(ax)k=(p(1+pax))n=pnk=0nk! (nk)!n!(pax)k

Pascal三角形: ( 1 + x ) n (1+x)^n (1+x)n,不同的n的二项式系数组成的三角形

1.6 Integration 积分

1.6.1 The Indefinite Integral 不定积分

f ( x ) f(x) f(x)的不定积分 ∫ f ( x ) d x \int f(x)dx f(x)dx

F ( x ) = ∫ f ( x ) d x d F ( x ) d x = f ( x ) F(x)=\int f(x)dx \\ \frac {dF(x)}{dx} = f(x) F(x)=f(x)dxdxdF(x)=f(x)

y = 2 x y=2x y=2x, d y d x = 2 \frac{dy}{dx}=2 dxdy=2, ∫ 2 d x = 2 x + C \int 2dx = 2x +C 2dx=2x+C, 注意常数项C对x的微分为0

不定积分的例子
∫ x n d x = 1 n + 1 x n + 1 + C ,   ( n ≠ − 1 ) ∫ 1 x d x = l n ( x ) + C ∫ e a x d x = 1 a e a x + C ∫ c o s ( a x ) d x = 1 a s i n ( a x ) + C ∫ s i n ( a x ) d x = − 1 a c o s ( a x ) + C \begin{aligned} \int x^n dx & = \frac{1}{n+1} x^{n+1} + C, \ (n \neq -1) \\ \int \frac{1}{x} dx & = ln(x) + C \\ \int e^{ax} dx & = \frac{1}{a} e^{ax} + C \\ \int cos(ax)dx & = \frac{1}{a}sin(ax) + C \\ \int sin(ax)dx & = -\frac{1}{a}cos(ax) + C \\ \end{aligned} xndxx1dxeaxdxcos(ax)dxsin(ax)dx=n+11xn+1+C, (n=1)=ln(x)+C=a1eax+C=a1sin(ax)+C=a1cos(ax)+C

Linearity 线性:积分是线性的
∫ ( α f ( x ) + β g ( x ) ) d x = α ∫ f ( x ) d x + β ∫ g ( x ) d x \int (\alpha f(x) + \beta g(x))dx = \alpha \int f(x)dx + \beta \int g(x)dx (αf(x)+βg(x))dx=αf(x)dx+βg(x)dx

∫ ( A x 2 + B x 4 ) d x = A ∫ x 2 d x + B ∫ x 3 d x = A 3 x 3 B 4 x 4 + C ∫ ( 3 e x + 2 x ) d x = 3 ∫ e x d x + 2 ∫ 1 x d x = 3 e x + 2 l n x + C \int (A x^2 + B x^4)dx = A \int x^2 dx + B \int x^3 dx = \frac{A}{3} x^3 \frac{B}{4} x^4 + C \\ \int (3 e^x + \frac{2}{x})dx = 3 \int e^x dx + 2 \int \frac{1}{x} dx = 3e^x + 2lnx + C (Ax2+Bx4)dx=Ax2dx+Bx3dx=3Ax34Bx4+C(3ex+x2)dx=3exdx+2x1dx=3ex+2lnx+C

1.6.2 The Definite Integral 定积分

f ( x ) f(x) f(x)的定积分 ∫ a b f ( x ) d x \int_a^b f(x)dx abf(x)dx

例子:
∫ − 1 1 e x d x = e x ∣ − 1 1 = e − 1 e \int _{-1}^{1} e^x dx = e^x | _{-1}^{1} = e - \frac{1}{e} 11exdx=ex11=ee1

∫ a x f ( x ) d x \int_a^x f(x)dx axf(x)dx 这种表示法,容易造成混淆,应使用哑变量

∫ a c f ( x ) d x = ∫ a b f ( x ) d x + ∫ b c f ( x ) d x \int_a^c f(x)dx = \int_a^b f(x)dx + \int_b^c f(x)dx acf(x)dx=abf(x)dx+bcf(x)dx, if a < b < c a < b < c a<b<c

∫ a c f ( x ) d x = − ∫ c a f ( x ) d x \int_a^c f(x)dx = - \int_c^a f(x)dx acf(x)dx=caf(x)dx

1.6.3 Integration by Substitution 代换积分法/换元法

∫ g ( f ( x ) ) f ′ ( x ) d x \int g(f(x))f'(x)dx g(f(x))f(x)dx

反向使用链式法则
z = f ( x ) z=f(x) z=f(x)
d z = f ′ ( x ) d x 可 得 ∫ g ( f ( x ) ) f ′ ( x ) d x = ∫ g ( z ) d z dz=f'(x)dx 可得\int g(f(x))f'(x)dx = \int g(z)dz dz=f(x)dxg(f(x))f(x)dx=g(z)dz

例子: ∫ 1 2 e x 2 2 x d x \int_1^2 e^{x^2}2xdx 12ex22xdx,
z = x 2 z=x^2 z=x2,
可得 ∫ 1 2 e x 2 2 x d x = ∫ 1 4 e z d z = e z ∣ 1 4 = e 4 − e 1 \int_1^2 e^{x^2}2xdx = \int_1^4 e^zdz = e^z | _1^4 = e^4-e^1 12ex22xdx=14ezdz=ez14=e4e1

重要例子 ∫ − ∞ ∞ e − x 2 d x \int_{-\infty}^{\infty} e^{-x^2}dx ex2dx
标准正态分布 Z ( x ) = 1 2 π e − x 2 2 Z(x) = \frac{1}{\sqrt{2 \pi}}e^{-\frac{x^2}{2}} Z(x)=2π 1e2x2
标准正态分布的CDF ∫ − ∞ ∞ Z ( x ) d x = 1 2 π ∫ − ∞ ∞ e − s 2 2 d s = 1 \int_{-\infty}^{\infty} Z(x)dx = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty} e^{-\frac{s^2}{2}}ds = 1 Z(x)dx=2π 1e2s2ds=1
x = s 2 x=\frac{s}{\sqrt{2}} x=2 s
可得 ∫ − ∞ ∞ e − x 2 d x = π \int_{-\infty}^{\infty} e^{-x^2}dx = \sqrt{\pi} ex2dx=π

奇函数和偶函数的积分:
∫ − a a f ( x ) d x = ∫ − a 0 f ( x ) d x + ∫ 0 a f ( x ) d x = − ∫ 0 − a f ( x ) d x + ∫ 0 a f ( x ) d x = ∫ 0 a f ( − x ) d x + ∫ 0 a f ( x ) d x = { 2 ∫ 0 a f ( x ) d x f(x)是偶函数 0 f(x)是奇函数 \begin{aligned} \int_{-a}^{a} f(x)dx & = \int_{-a}^{0} f(x)dx + \int_{0}^{a} f(x)dx \\ & = -\int_{0}^{-a} f(x)dx + \int_{0}^{a} f(x)dx \\ & = \int_{0}^{a} f(-x)dx + \int_{0}^{a} f(x)dx \\ & = \begin{cases} 2 \int_{0}^{a} f(x)dx & \text{f(x)是偶函数}\\ 0 & \text{f(x)是奇函数} \end{cases} \end{aligned} aaf(x)dx=a0f(x)dx+0af(x)dx=0af(x)dx+0af(x)dx=0af(x)dx+0af(x)dx={20af(x)dx0f(x)是偶函数f(x)是奇函数

1.6.4 Integration by Parts 分部积分法

∫ u ′ v d x \int u'vdx uvdx

反向使用乘法法则
∫ u ′ v d x = u v − ∫ u v ′ d x + C \int u'vdx = uv - \int uv'dx + C uvdx=uvuvdx+C

分部积分法的使用场景:v是多项式函数,u是指数函数

例子: ∫ x e x d x \int xe^xdx xexdx
令: v = x , v ′ = 1 , u = e x , u ′ = e x v=x, v'=1, u=e^x, u'=e^x v=x,v=1,u=ex,u=ex
得到: ∫ x e x d x = u v − ∫ u v ′ d x + C = x e x − ∫ e x × 1 d x = e x ( x − 1 ) + C \int xe^xdx = uv - \int uv'dx + C = xe^x - \int e^x \times 1dx = e^x(x-1) + C xexdx=uvuvdx+C=xexex×1dx=ex(x1)+C

弱国多项式部分的次数大于1,反复使用分部积分法直到变为0次

经典问题: ∫ e x s i n x d x \int e^x sinx dx exsinxdx
v = e x , u ′ = s i n x , v ′ = e x , u = − c o s x v=e^x, u'=sinx, v'=e^x, u=-cosx v=ex,u=sinx,v=ex,u=cosx
得到: ∫ e x s i n x d x = − e x c o s x + ∫ e x c o s x d x \int e^x sinx dx = -e^xcosx + \int e^x cosx dx exsinxdx=excosx+excosxdx
v = e x , u ′ = c o s x , v ′ = e x , u = s i n x v=e^x, u'=cosx, v'=e^x, u=sinx v=ex,u=cosx,v=ex,u=sinx
得到: ∫ e x c o s x d x = e x s i n x − ∫ e x s i n x d x \int e^x cosx dx = e^xsinx - \int e^x sinx dx excosxdx=exsinxexsinxdx
将上两个等式相加,消去 ∫ e x c o s x d x \int e^x cosx dx excosxdx项得到
∫ e x s i n x d x = 1 2 e x ( s i n x − c o s x ) \int e^x sinx dx=\frac{1}{2}e^x(sinx-cosx) exsinxdx=21ex(sinxcosx)
∫ e x c o s x d x = 1 2 e x ( s i n x + c o s x ) \int e^x cosx dx=\frac{1}{2}e^x(sinx+cosx) excosxdx=21ex(sinx+cosx)

1.6.5 Reduction Formula 约化公式

∫ 0 ∞ e − t t n d t = I n \int_{0}^{\infty} e^{-t}t^ndt = I_n 0ettndt=In

用部分积分法逐次消去多项式项,得到 I n = n ! I 0 I_n = n!I_0 In=n!I0, 注意 e − t t n ∣ 0 ∞ = 0 e^{-t}t^n|_{0}^{\infty}=0 ettn0=0
I 0 = ∫ 0 ∞ e − t d t = 1 I_0 = \int_{0}^{\infty} e^{-t}dt = 1 I0=0etdt=1, I n = n ! I_n = n! In=n!
I n I_n In称为Gamma函数( Γ \Gamma Γ函数)

1.6.6 Other Results 其他法则

∫ f ′ ( x ) f ( x ) = l n ∣ f ( x ) ∣ + C \int \frac{f'(x)}{f(x)} = ln|f(x)| +C f(x)f(x)=lnf(x)+C
∫ 1 a + b x = 1 b l n ∣ a + b x ∣ + C \int \frac{1}{a+bx} = \frac{1}{b}ln|a+bx| + C a+bx1=b1lna+bx+C

Partial Fractions:部分分式分解
h ( x ) = f ( x ) g ( x ) = ∑ n = 0 N a n x n ∑ n = 0 M b n x n h(x) = \frac{f(x)}{g(x)} = \frac{\sum_{n=0}^{N} a_n x^n}{\sum_{n=0}^{M} b_n x^n} h(x)=g(x)f(x)=n=0Mbnxnn=0Nanxn

如果N<M,则h(x)称为部分分式分解

c ( x + a ) ( x + b ) ≡ A x + a + B x + b c = A ( x + b ) + B ( x + a ) \frac{c}{(x+a)(x+b)} \equiv \frac{A}{x+a} + \frac{B}{x+b} \\ c = A(x+b) + B(x+a) (x+a)(x+b)cx+aA+x+bBc=A(x+b)+B(x+a)
求解出A和B,得到部分分式分解

  • 重复的因式:
    c ( x + a ) 2 ( x + b ) 3 = A x + a + B ( x + a ) 2 + C x + b + D ( x + b ) 2 + E ( x + b ) 3 \frac{c}{(x+a)^2(x+b)^3} = \frac{A}{x+a} + \frac{B}{(x+a)^2} + \frac{C}{x+b} + \frac{D}{(x+b)^2} + \frac{E}{(x+b)^3} (x+a)2(x+b)3c=x+aA+(x+a)2B+x+bC+(x+b)2D+(x+b)3E

  • 未分解的高次项
    2 x + 1 ( x 2 + 3 x + 2 ) ( x − 1 ) = A x + B x 2 + 3 x + 2 + C x − 1 \frac{2x+1}{(x^2+3x+2)(x-1)} = \frac{Ax+B}{x^2+3x+2} + \frac{C}{x-1} (x2+3x+2)(x1)2x+1=x2+3x+2Ax+B+x1C

1.7 Complex Numbers 复数

复数的定义
z = x + i y z = x + iy z=x+iy where x , y ∈ R x, y \in R x,yR and i = − 1 i = \sqrt{-1} i=1
x x x称为实部real part, y y y称为虚部imaginary part

极坐标表示形式 z = r ( c o s θ + i   s i n θ ) z = r(cos\theta + i \ sin\theta) z=r(cosθ+i sinθ)
x = r   c o s θ ,   y = r   s i n θ ) ,   θ = a r c t a n y x x = r \ cos\theta, \ y =r \ sin\theta), \ \theta = arctan \frac{y}{x} x=r cosθ, y=r sinθ), θ=arctanxy

在这里插入图片描述
共轭conjugate
z = x + i y z=x+iy z=x+iy z = x − i y z=x-iy z=xiy互为共轭复数

1.7.1 Arithmetic 算术运算
  • 加减法: z 1 ± z 2 = ( x 1 ± x 2 ) + i ( y 1 ± y 2 ) ) z_1 \pm z_2 = (x_1 \pm x_2) + i(y_1 \pm y_2)) z1±z2=(x1±x2)+i(y1±y2))
  • 乘法: z 1 × z 2 = ( x 1 x 2 − y 1 y 2 ) + i ( x 1 y 2 + x 2 y 1 ) z_1 \times z_2 = (x_1 x_2 - y_1 y_2) + i(x_1 y_2 + x_2 y_1) z1×z2=(x1x2y1y2)+i(x1y2+x2y1)
  • 除法: z 1 z 2 = 1 x 2 2 + y 2 2 ( ( x 1 x 2 + y 1 y 2 ) + i ( x 1 y 2 − x 2 y 1 ) ) \frac{z_1}{z_2} = \frac{1}{x_2 ^ 2 + y_2 ^ 2} ((x_1 x_2 + y_1 y_2) + i(x_1 y_2 - x_2 y_1)) z2z1=x22+y221((x1x2+y1y2)+i(x1y2x2y1))
    除法相当于上下都乘以 z 2 z_2 z2的共轭复数 x 2 − i   y 2 x_2 - i \ y_2 x2i y2
1.7.2 Complex Conjugate Identities 共轭复数的性质
  1. 共轭的共轭 ( z ˉ ) ‾ = z \overline {(\bar z)} = z (zˉ)=z
  2. 加法的共轭 ( z 1 + z 2 ) ‾ = z 1 ‾ + z 2 ‾ \overline {(z_1 + z_2)} = \overline {z_1} + \overline {z_2} (z1+z2)=z1+z2
  3. 乘积的共轭 ( z 1 × z 2 ) ‾ = z 1 ‾ × z 2 ‾ \overline {(z_1 \times z_2)} = \overline {z_1} \times \overline {z_2} (z1×z2)=z1×z2
  4. 共轭相加 z + z ˉ = 2 x = 2 R e   z R e   z = z + z ˉ 2 z + \bar z = 2x = 2 Re \ z \\ Re \ z = \frac{z + \bar z}{2} z+zˉ=2x=2Re zRe z=2z+zˉ
  5. 共轭相减 z − z ˉ = 2 i y = 2 i I m   z I m   z = z − z ˉ 2 i z - \bar z = 2iy = 2i Im \ z \\ Im \ z = \frac{z - \bar z}{2i} zzˉ=2iy=2iIm zIm z=2izzˉ
  6. 共轭相乘 z × z ˉ = ( x + i y ) ( x − i y ) = ∣ z ∣ 2 z \times \bar z = (x + iy)(x - iy) = |z|^2 z×zˉ=(x+iy)(xiy)=z2
1.7.3 Polar Form 极坐标形式

z = r ( c o s θ + i   s i n θ ) = r e i θ e i θ = c o s θ + i   s i n θ z = r(cos \theta + i \ sin\theta) = re^{i \theta} \\ e^{i \theta} = cos \theta + i \ sin\theta z=r(cosθ+i sinθ)=reiθeiθ=cosθ+i sinθ

极坐标形式的乘除法非常简便

Euler’s Formula 欧拉公式

可以通过泰勒级数证明 e i θ = c o s θ + i   s i n θ e^{i \theta} = cos \theta + i \ sin\theta eiθ=cosθ+i sinθ,关键点在于 i 2 = − 1 i^2=-1 i2=1

泰勒展开式
e x = ∑ n = 0 ∞ x n n ! s i n   x = ∑ n = 0 ∞ ( − 1 ) n x ( 2 n + 1 ) ( 2 n + 1 ) ! c o s   x = ∑ n = 0 ∞ ( − 1 ) n x ( 2 n ) ( 2 n ) ! \begin{aligned} e^x & = \sum_{n=0}^{\infty} \frac{x^n}{n!} \\ sin \ x & = \sum_{n=0}^{\infty} (-1)^n \frac{x^{(2n+1)}}{(2n+1)!} \\ cos \ x & = \sum_{n=0}^{\infty} (-1)^n \frac{x^{(2n)}}{(2n)!} \\ \end{aligned} exsin xcos x=n=0n!xn=n=0(1)n(2n+1)!x(2n+1)=n=0(1)n(2n)!x(2n)

欧拉公式的证明
e i θ = ∑ n = 0 ∞ ( i θ ) n n ! = ∑ n = 0 ∞ ( i θ ) ( 2 n ) ( 2 n ) ! + ∑ n = 0 ∞ ( i θ ) ( 2 n + 1 ) ( 2 n + 1 ) ! = ∑ n = 0 ∞ i ( 2 n ) θ ( 2 n ) ( 2 n ) ! + ∑ n = 0 ∞ i × i ( 2 n ) θ ( 2 n + 1 ) ( 2 n + 1 ) ! = ∑ n = 0 ∞ ( − 1 ) n x ( 2 n ) ( 2 n ) ! + i ∑ n = 0 ∞ ( − 1 ) n x ( 2 n + 1 ) ( 2 n + 1 ) ! = c o s θ + i s i n θ \begin{aligned} e^{i \theta} & = \sum_{n=0}^{\infty} \frac{(i \theta)^n}{n!} \\ & = \sum_{n=0}^{\infty} \frac{(i \theta)^{(2n)}}{(2n)!} + \sum_{n=0}^{\infty} \frac{(i \theta)^{(2n+1)}}{(2n+1)!} \\ & = \sum_{n=0}^{\infty} \frac{i^{(2n)} \theta^{(2n)}}{(2n)!} + \sum_{n=0}^{\infty} \frac{i \times i^{(2n)} \theta^{(2n+1)}}{(2n+1)!} \\ &= \sum_{n=0}^{\infty} (-1)^n \frac{x^{(2n)}}{(2n)!} + i \sum_{n=0}^{\infty} (-1)^n \frac{x^{(2n+1)}}{(2n+1)!} \\ &= cos \theta + i sin \theta \\ \end{aligned} eiθ=n=0n!(iθ)n=n=0(2n)!(iθ)(2n)+n=0(2n+1)!(iθ)(2n+1)=n=0(2n)!i(2n)θ(2n)+n=0(2n+1)!i×i(2n)θ(2n+1)=n=0(1)n(2n)!x(2n)+in=0(1)n(2n+1)!x(2n+1)=cosθ+isinθ

用欧拉公式计算 ∫ e x s i n x d x \int e^x sinx dx exsinxdx
∫ e x s i n x d x = ∫ e x I m e i x d x = ∫ I m e ( 1 + i ) x d x = I m 1 1 + i e ( 1 + i ) x d x = e x I m 1 − i 2 e i x d x = 1 2 e x I m ( 1 − i ) ( c o s x + i s i n x ) = 1 2 e x ( s i n x − c o s x ) \begin{aligned} \int e^x sinx dx & = \int e^x Im e^{ix} dx \\ & = \int Im e^{(1 + i)x} dx \\ & = Im \frac{1}{1+i}e^{(1 + i)x} dx \\ & = e^x Im \frac{1-i}{2}e^{ix} dx \\ & = \frac{1}{2} e^x Im (1 - i)(cosx+isinx) \\ & = \frac{1}{2} e^x (sinx - cosx) \end{aligned} exsinxdx=exImeixdx=Ime(1+i)xdx=Im1+i1e(1+i)xdx=exIm21ieixdx=21exIm(1i)(cosx+isinx)=21ex(sinxcosx)

同样的方法可以得到 ∫ e x s i n x d x = 1 2 e x ( s i n x + c o s x ) \int e^x sinx dx = \frac{1}{2} e^x (sinx + cosx) exsinxdx=21ex(sinx+cosx)

1.8 Functions of Several Variables: Multivariate Calculus 多变量函数:多变量微积分

偏微分 partial derivative
f ( x , y ) f(x, y) f(x,y)定义偏微分
∂ f ∂ x = l i m δ x → 0 f ( x + δ x , y ) − f ( x , y ) δ x \frac {\partial f}{\partial x} = lim_{\delta x \to 0} \frac{f(x + \delta x, y) - f(x, y)}{\delta x} xf=limδx0δxf(x+δx,y)f(x,y)
其中y保持不变(看作常量)
偏微分也记作 f x ,   f y f_x, \ f_y fx, fy

高阶偏微分
∂ 2 f ∂ x 2 = f x x = ∂ ∂ x ( ∂ f ∂ x ) ∂ 2 f ∂ y 2 = f y y = ∂ ∂ y ( ∂ f ∂ y ) ∂ 2 f ∂ x ∂ y = f x y = ∂ ∂ y ( ∂ f ∂ x ) ∂ 2 f ∂ y ∂ x = f y x = ∂ ∂ x ( ∂ f ∂ y ) \frac {\partial ^2 f}{\partial x^2} = f_{xx} = \frac {\partial}{\partial x} (\frac {\partial f}{\partial x}) \\ \frac {\partial ^2 f}{\partial y^2} = f_{yy} = \frac {\partial}{\partial y} (\frac {\partial f}{\partial y}) \\ \frac {\partial ^2 f}{\partial x \partial y} = f_{xy} = \frac {\partial}{\partial y} (\frac {\partial f}{\partial x}) \\ \frac {\partial ^2 f}{ \partial y \partial x} = f_{yx} = \frac {\partial}{\partial x} (\frac {\partial f}{\partial y}) \\ x22f=fxx=x(xf)y22f=fyy=y(yf)xy2f=fxy=y(xf)yx2f=fyx=x(yf)

1.8.1 The Chain Rule I 链式法则I

单变量:
f ( u ) ,   u = g ( x ) d f d x = d f d u × d u d x f(u), \ u=g(x) \\ \frac{df}{dx} = \frac{df}{du} \times \frac{du}{dx} f(u), u=g(x)dxdf=dudf×dxdu

多变量: 多个变量都是某个最终变量的函数
f ( x , y ) ,   x = x ( s ) ,   y = y ( s ) d f d s = ∂ f ∂ x × d x d s + ∂ f ∂ y × d y d s f(x, y), \ x=x(s), \ y=y(s) \\ \frac{df}{ds} = \frac{\partial f}{\partial x} \times \frac{dx}{ds} + \frac{\partial f}{\partial y} \times \frac{dy}{ds} f(x,y), x=x(s), y=y(s)dsdf=xf×dsdx+yf×dsdy

1.8.2 The Chain Rule II 链式法则II

多变量: 多个变量都是某一组最终变量的函数
f ( x , y ) ,   x = x ( u , v ) ,   y = y ( u , v ) d f d u = ∂ f ∂ x × ∂ x ∂ u + ∂ f ∂ y × ∂ y ∂ u f(x, y), \ x=x(u,v), \ y=y(u,v) \\ \frac{df}{du} = \frac{\partial f}{\partial x} \times \frac{\partial x}{\partial u} + \frac{\partial f}{\partial y} \times \frac{\partial y}{\partial u} f(x,y), x=x(u,v), y=y(u,v)dudf=xf×ux+yf×uy

1.8.3 Taylor for two Variables 两变量泰勒展开

f ( x , t ) f(x,t) f(x,t) x = x 0 ,   t = t 0 x=x_0, \ t=t_0 x=x0, t=t0处展开

f ( x ) = f ( x 0 , t 0 ) + f x ( x 0 , t 0 ) ( x − x 0 ) + f t ( x 0 , t 0 ) ( t − t 0 ) + 1 2 { f x x ( x 0 , t 0 ) ( x − x 0 ) 2 + 2 f x t ( x 0 , t 0 ) ( x − x 0 ) ( t − t 0 ) + f t t ( x 0 , t 0 ) ( t − t 0 ) 2 } + … \begin{aligned} f(x) = & f(x_0, t_0) \\ & + f_x(x_0, t_0)(x - x_0) + f_t(x_0, t_0)(t - t_0) \\ & + \frac{1}{2} \left\{ \begin{aligned} & f_{xx}(x_0, t_0)(x - x_0)^2 \\ & + 2f_{xt}(x_0, t_0)(x - x_0)(t - t_0) \\ & + f_{tt}(x_0, t_0)(t - t_0)^2 \\ \end{aligned} \right\} \\ & + \dots \end{aligned} f(x)=f(x0,t0)+fx(x0,t0)(xx0)+ft(x0,t0)(tt0)+21fxx(x0,t0)(xx0)2+2fxt(x0,t0)(xx0)(tt0)+ftt(x0,t0)(tt0)2+

2 Linear Algebra 线性代数

2.1 Properties of Vectors 向量的性质

n维空间 R n R_n Rn
n维向量
v ⃗ = [ v 1 v 2 ⋮ v n ] ∈ R n \vec \boldsymbol v = \left[ \begin{matrix} v_1 \\ v_2 \\ \vdots \\ v_n \\ \end{matrix} \right] \in R_n v =v1v2vnRn
v i ,   ( i = 1 , 2 , ⋯   , n ) v_i, \ (i = 1, 2, \cdots, n) vi, (i=1,2,,n)是向量 v v v的第i个维度

2.1.1 Vector Arithmetic 向量算术

相同维度的向量和
u ⃗ + v ⃗ = [ u 1 + v 1 u 2 + v 2 ⋮ u n + v n ] \vec \boldsymbol u + \vec \boldsymbol v = \left[ \begin{matrix} u_1 + v_1 \\ u_2 + v_2 \\ \vdots \\ u_n + v_n \\ \end{matrix} \right] u +v =u1+v1u2+v2un+vn

向量和标量的乘法

k v ⃗ = [ k v 1 k v 2 ⋮ k v n ] k \vec \boldsymbol v = \left[ \begin{matrix} kv_1 \\ kv_2 \\ \vdots \\ kv_n \\ \end{matrix} \right] kv =kv1kv2kvn

向量点积

u ⃗ . v ⃗ = ∑ i = 1 n u i v i \vec \boldsymbol u . \vec \boldsymbol v = \sum_{i=1}^{n} u_i v_i u .v =i=1nuivi

u ⃗ . v ⃗ = v ⃗ . u ⃗ \vec \boldsymbol u . \vec \boldsymbol v = \vec \boldsymbol v . \vec \boldsymbol u u .v =v .u

2.1.2 Concept of Length in R n R_n Rn n维空间中的向量长度

向量长度
∣ u ⃗ ∣ = ∑ i = 1 n u i 2 u ⃗ = ∣ u ⃗ ∣ u ⃗ ^ u ⃗ ^ = u ⃗ ∣ u ⃗ ∣ ∣ u ⃗ ^ ∣ = 1 |\vec \boldsymbol u | = \sum_{i=1}^{n} u_i^2 \\ \vec \boldsymbol u = |\vec \boldsymbol u | \hat{\vec \boldsymbol u} \\ \hat{\vec \boldsymbol u}= \frac{\vec \boldsymbol u }{|\vec \boldsymbol u | } \\ |\hat{\vec \boldsymbol u}| = 1 u =i=1nui2u =u u ^u ^=u u u ^=1

u ⃗ ^ \hat{\vec \boldsymbol u} u ^是单位向量,反映向量的方向

向量距离
∣ u ⃗ − v ⃗ ∣ = ∑ i = 1 n ( u i − v i ) 2 |\vec \boldsymbol u - \vec \boldsymbol v| = \sum_{i=1}^{n} (u_i - v_i)^2 u v =i=1n(uivi)2

向量 u ⃗ \vec \boldsymbol u u 长度也叫L2 norm/欧几里得norm: ∥ u ⃗ ∥ = ∑ i = 1 n u i 2 \left \| \vec \boldsymbol u \right \| = \sum_{i=1}^{n} u_i^2 u =i=1nui2

L2距离/欧几里得距离: ∥ u ⃗ − v ⃗ ∥ = ∑ i = 1 n ( u i − v i ) 2 \left \| \vec \boldsymbol u - \vec \boldsymbol v \right \| = \sum_{i=1}^{n} (u_i - v_i)^2 u v =i=1n(uivi)2

余弦夹角

u ⃗ . v ⃗ = ∣ u ⃗ ∣ ∣ v ⃗ ∣ c o s θ → c o s θ = ∑ i = 1 n u i v i ∣ u ⃗ ∣ ∣ v ⃗ ∣ \vec \boldsymbol u . \vec \boldsymbol v = |\vec \boldsymbol u| |\vec \boldsymbol v| cos \theta \\ \rightarrow cos \theta = \frac{\sum_{i=1}^{n} u_i v_i}{ |\vec \boldsymbol u| |\vec \boldsymbol v|} \\ u .v =u v cosθcosθ=u v i=1nuivi

余弦夹角可以理解为两个向量的归一化距离

向量正交:

  • 两个向量的点积为0, u ⃗ . v ⃗ = 0 \vec \boldsymbol u . \vec \boldsymbol v=0 u .v =0
  • 向量夹角为90°

2.2 Matrices 矩阵

A m × n \boldsymbol A_{m \times n} Am×n 表示m行n列的矩阵
A = [ a 11 a 12 ⋯ a 1 n a 21 a 22 ⋯ a 2 n ⋮ ⋮ ⋱ ⋮ a m 1 a m 2 ⋯ a m n ] A = ( a i j )   f o r   i = 1 , 2 , ⋯   , m ;   j = 1 , 2 , ⋯   , n \boldsymbol A = \left[ \begin{matrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \\ \end{matrix} \right] \\ \boldsymbol A = (a_{ij}) \ for \ i = 1,2, \cdots, m; \ j = 1, 2, \cdots, n A=a11a21am1a12a22am2a1na2namnA=(aij) for i=1,2,,m; j=1,2,,n

2.2.1 Matrix Arithmetic 矩阵算术

矩阵加法 : 对应元素相加

交换律 A + B = B + A \boldsymbol A + \boldsymbol B = \boldsymbol B + \boldsymbol A A+B=B+A

2.2.2 Matrix Multiplication 矩阵乘法

矩阵乘法: C p m = A p n B n m \boldsymbol C_{pm} = \boldsymbol A_{pn} \boldsymbol B_{nm} Cpm=ApnBnm
A的列数和B的行数应该相同

C i j = A i ⃗ . B j ⃗ = ∑ k = 1 N A i k B k j \boldsymbol C_{ij} = \vec{\boldsymbol A_i} . \vec{\boldsymbol B_j} = \sum_{k=1}^N \boldsymbol A_{ik} \boldsymbol B_{kj} Cij=Ai .Bj =k=1NAikBkj

2.2.3 Transpose 转置

矩阵的行列交换

( A + B ) T = A T + B T ( A T ) T = A ( k A ) T = k A T ( A B ) T = B T A T {(\boldsymbol A+\boldsymbol B)}^T = {\boldsymbol A}^T + {\boldsymbol B}^T \\ {({\boldsymbol A}^T)}^T = \boldsymbol A \\ {(k \boldsymbol A)}^T = k {\boldsymbol A}^T \\ {(\boldsymbol A \boldsymbol B)}^T = {\boldsymbol B}^T {\boldsymbol A}^T \\ (A+B)T=AT+BT(AT)T=A(kA)T=kAT(AB)T=BTAT

skew symmetric matrix 斜对称矩阵 : A + A T = 0 ; a i i = 0 , a i j = − a j i \boldsymbol A + {\boldsymbol A}^T = 0; a_{ii}=0, a_{ij} = -a_{ji} A+AT=0;aii=0,aij=aji

2.2.4 Matrix Representation of Linear Equations 线性方程组的矩阵表达形式

线性方程组
{ a x + b y = p c x + d y = q \left\{ \begin{aligned} ax + by = p \\ cx + dy = q \\ \end{aligned} \right. {ax+by=pcx+dy=q

a d − b c ≠ 0 ad - bc \neq 0 adbc=0时,方程组有唯一解

{ x = d p − b q a d − b c y = a q − c p a d − b c \left\{ \begin{aligned} x = \frac{dp - bq}{ad - bc} \\ y = \frac{aq - cp}{ad - bc} \\ \end{aligned} \right. x=adbcdpbqy=adbcaqcp

a d − b c = 0 ad - bc = 0 adbc=0时,可能无解,也可能有无穷多解

矩阵表示
[ a b c d ] × [ x y ] = [ p q ] A x ⃗ = p ⃗ \left[ \begin{matrix} a & b \\ c & d \\ \end{matrix} \right] \times \left[ \begin{matrix} x \\ y \\ \end{matrix} \right] = \left[ \begin{matrix} p \\ q \\ \end{matrix} \right] \\ \boldsymbol A \vec \boldsymbol x = \vec \boldsymbol p [acbd]×[xy]=[pq]Ax =p

行列式 determinant
∣ a b c d ∣ = a d − b c \left| \begin{matrix} a & b \\ c & d \\ \end{matrix} \right| = ad - bc acbd=adbc

方阵行列式不为0,表示矩阵可逆

单位阵 identity matrix
∣ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ⋮ 0 0 0 ⋯ 1 ∣ = a d − b c \left| \begin{matrix} 1 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \\ \end{matrix} \right| = ad - bc 1000010000100001=adbc

I A = A I = A \boldsymbol I \boldsymbol A = \boldsymbol A \boldsymbol I = \boldsymbol A IA=AI=A

三对角矩阵(Tridiagonal Matrices)

三对角矩阵
从右到左三条对角线分别是:super、main、sub

2.3 Using Matrix Notation For Solving Linear Systems 矩阵术语

线性方程组
{ a x + b y + c z = p d x + e y + f z = q g x + h y + i z = r \left\{ \begin{aligned} ax + by + cz = p \\ dx + ey + fz = q \\ gx + hy + iz = r \\ \end{aligned} \right. ax+by+cz=pdx+ey+fz=qgx+hy+iz=r

[ a b c d e f g h i ] × [ x y z ] = [ p q r ] A x ⃗ = p ⃗ \left[ \begin{matrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{matrix} \right] \times \left[ \begin{matrix} x \\ y \\ z \\ \end{matrix} \right] = \left[ \begin{matrix} p \\ q \\ r \\ \end{matrix} \right] \\ \boldsymbol A \vec \boldsymbol x = \vec \boldsymbol p adgbehcfi×xyz=pqrAx =p

A \boldsymbol A A是系数矩阵

增广矩阵 augmented matrix
[ a b c d e f g h i p q r ] \left [ \begin{array}{c|c} \begin{matrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{matrix} & \begin{matrix} p \\ q \\ r \\ \end{matrix} \end{array} \right ] adgbehcfipqr

行阶梯形式 echelon form,对增广矩阵化简,对角线以下部分全部是0

矩阵行操作(对方程组的解没有影响)

  • [ E R 1 ] [ER_1] [ER1]: 行交换
  • [ E R 2 ] [ER_2] [ER2]: 行乘以系数k
  • [ E R 3 ] [ER_3] [ER3]: 行加上其他行乘以系数k

通过行操作将增广矩阵变换为行阶梯形式

2.4 Matrix Inverse 逆变换

A A − 1 = A − 1 A = I \boldsymbol A \boldsymbol A^ {-1} = \boldsymbol A^ {-1} \boldsymbol A = I AA1=A1A=I

A x ⃗ = p ⃗ → x = A − 1 p ⃗ \boldsymbol A \vec \boldsymbol x = \vec \boldsymbol p \rightarrow \boldsymbol x = \boldsymbol A^ {-1} \vec \boldsymbol p Ax =p x=A1p

( a b c d ) − 1 = 1 a d − b c ( d − b − c a ) ,   a d − b c ≠ 0 \left( \begin{matrix} a & b \\ c & d \\ \end{matrix} \right) ^ {-1} = \frac{1}{ad-bc} \left( \begin{matrix} d & -b \\ -c & a \\ \end{matrix} \right), \ ad-bc \neq 0 (acbd)1=adbc1(dcba), adbc=0

用行列式计算逆矩阵

A − 1 = 1 ∣ A ∣ a d j   A a d j   A = [ ( − 1 ) i + j ∣ M i j ∣ ] T \boldsymbol A^ {-1} = \frac{1}{|\boldsymbol A|} adj\ \boldsymbol A \\ adj\ \boldsymbol A = [ (-1)^{i+j} |\boldsymbol M_{ij}|]^T A1=A1adj Aadj A=[(1)i+jMij]T
( − 1 ) i + j M i j (-1)^{i+j} \boldsymbol M_{ij} (1)i+jMij 是行列式的余子式cofactor,从矩阵A去掉i行j列剩下的部分组成的矩阵,

行列式计算规则:

  • [ E R 1 ] : R i ↔ R j ⇒ ∣ A ∣ = − ∣ A ∣ [ER_1]: R_i \leftrightarrow R_j \Rightarrow |\boldsymbol A| = -|\boldsymbol A| [ER1]:RiRjA=A
  • [ E R 2 ] : R i ↔ k R i ⇒ ∣ A ∣ = k ∣ A ∣ [ER_2]: R_i \leftrightarrow kR_i \Rightarrow |\boldsymbol A| = k|\boldsymbol A| [ER2]:RikRiA=kA

2.5 Orthogonal Matrices 正交矩阵

A A T = A T A = I A − 1 = A T \boldsymbol A \boldsymbol A^T = \boldsymbol A^T \boldsymbol A = I \\ \boldsymbol A^ {-1} = \boldsymbol A^T AAT=ATA=IA1=AT

2.6 Eigenvalues and Eigenvectors 特征值和特征向量

A v ⃗ = λ v ⃗ ( A − λ I ) v ⃗ = 0 d e t ( A − λ I ) = 0 \boldsymbol A \vec \boldsymbol v = \lambda \vec \boldsymbol v \\ (\boldsymbol A - \lambda \boldsymbol I) \vec \boldsymbol v = 0 \\ det(\boldsymbol A - \lambda \boldsymbol I) = 0 \\ Av =λv (AλI)v =0det(AλI)=0

2.6.1 Criteria for invertibility 可逆
  • 行列式不为0
  • 所有特征值都非零
  • strictly diagonally dominant 严格对角占优(充分不必要)

3 Differential Equations 微分方程

3.1 Introduction 简介

两种类型

  • Ordinary Differential Equation (O.D.E) 常微分方程
    F ( x , y , y ′ , y ′ ′ ′ , ⋯   , y ( n ) ) = 0 F(x, y, y',y''', \cdots, y^{(n)}) = 0 F(x,y,y,y,,y(n))=0
    y 4 ≠ y ( 4 ) y^4 \neq y^{(4)} y4=y(4)

  • Partial Differential Equation (PDE) 偏微分方程
    ∂ u ∂ t + ∂ 2 u ∂ x ∂ y + ∂ u ∂ z + u = 0 \frac{\partial u}{\partial t} + \frac{\partial ^2 u}{\partial x \partial y} + \frac{\partial u}{\partial z} + u = 0 tu+xy2u+zu+u=0

术语:

  • order : n, 微分方程的最大阶数
  • degree : r, 微分方程order的的次数(pow)

y ′ ′ + x ( y ′ ) 3 − x y y'' + x(y')^3 - xy y+x(y)3xy 是二阶(order=2)一次(degree=1)
y ′ ′ = y ′ + y + x y'' = \sqrt{y' + y + x} y=y+y+x 是二阶二次方程

线性ODE:

n阶线性方程
∑ i = 0 n a i ( x ) y ( i ) ( x ) = g ( x ) \sum_{i=0}^{n} a_i(x)y^{(i)}(x) = g(x) i=0nai(x)y(i)(x)=g(x)
所有微分都是1次,系数是x的函数(a(x)和g(x)不要求是1次,可以是常数,但不是y的函数)

对函数 y = f ( x , c 1 , c 2 , ⋯   , c n ) y = f(x, c_1, c_2, \cdots, c_n) y=f(x,c1,c2,,cn)逐次,得到n个方程,
联合n+1个方程消去 c 1 , c 2 , ⋯   , c n c_1, c_2, \cdots, c_n c1,c2,,cn, 得到 f ( x , y , y ′ , y ′ ′ , ⋯   , y ( n ) ) = 0 f(x, y, y', y'', \cdots, y^{(n)}) = 0 f(x,y,y,y,,y(n))=0

反过来理解: y = f ( x , c 1 , c 2 , ⋯   , c n ) y = f(x, c_1, c_2, \cdots, c_n) y=f(x,c1,c2,,cn) f ( x , y , y ′ , y ′ ′ , ⋯   , y ( n ) ) = 0 f(x, y, y', y'', \cdots, y^{(n)}) = 0 f(x,y,y,y,,y(n))=0的通解

3.1.1 Initial & Boundary Value Problems 初始值问题和边界值问题

从通解得到特解

  • Initial Value Problem (IVP)
    y ( i ) ( x 0 ) = α i ,   w h e r e   i = 0 , 1 , ⋯   , n − 1 y^{(i)}(x_0)= \alpha_i, \ where \ i = 0,1, \cdots, n-1 y(i)(x0)=αi, where i=0,1,,n1,一共n个初始值条件
    y ′ ′ + 2 y ′ = e x ;   y ( π ) = 1 ,   y ′ ( π ) = 2 y'' + 2y' = e^x; \ y(\pi)=1, \ y'(\pi)=2 y+2y=ex; y(π)=1, y(π)=2

  • Boudary Value Problem (BVP)
    y ( x i ) = β i ,   w h e r e   i = 0 , 1 , ⋯   , n − 1 y(x_i)= \beta_i, \ where \ i = 0,1, \cdots, n-1 y(xi)=βi, where i=0,1,,n1,一共n个边界值条件
    y ′ ′ + 2 y ′ = e x ;   y ( 0 ) = 1 ,   y ( 1 ) = 1 y'' + 2y' = e^x; \ y(0)=1, \ y(1)=1 y+2y=ex; y(0)=1, y(1)=1

3.2 First Order Ordinary Differential Equations 一阶常微分方程

一阶ODE的一般形式 F ( x , y , y ′ ) = 0 F(x, y, y')=0 F(x,y,y)=0

3.2.1 One Variable Missing 缺少一个变量

x, y, y’中,没有x或者y的方程,可以用积分求解

  • 没有y
    y ′ = f ( x ) → y = ∫ f ( x ) d x y'=f(x) \rightarrow y = \int f(x)dx y=f(x)y=f(x)dx

  • 没有y’
    y ′ = f ( y ) → x = ∫ 1 f ( y ) d x y'=f(y) \rightarrow x = \int \frac{1}{f(y)}dx y=f(y)x=f(y)1dx

3.2.2 Variable Separable 变量分离

通过积分得到通解

y ′ = g ( x ) h ( y ) → ∫ 1 h ( y ) d y = ∫ g ( x ) d x + c y' = g(x)h(y) \rightarrow \int \frac{1}{h(y)}dy = \int g(x)dx + c y=g(x)h(y)h(y)1dy=g(x)dx+c

3.2.3 Linear Equations 线性方程

用乘法法则进行组合,通过积分求解

求解
y ′ + P ( x ) y = Q ( x ) → R ( x ) y ′ + R ( x ) P ( x ) y = d d x ( R ( x ) y ) = R ( x ) Q ( x ) → R ( x ) y = ∫ R ( x ) Q ( x ) d x + c → y = 1 R ( x ) ( ∫ R ( x ) Q ( x ) d x + c ) \begin{aligned} & y' + P(x)y = Q(x) \\ & \rightarrow R(x)y' + R(x)P(x)y = \frac{d}{dx}(R(x)y) = R(x)Q(x) \\ & \rightarrow R(x)y = \int R(x)Q(x)dx + c \\ & \rightarrow y = \frac{1}{R(x)}(\int R(x)Q(x)dx + c) \\ \end{aligned} y+P(x)y=Q(x)R(x)y+R(x)P(x)y=dxd(R(x)y)=R(x)Q(x)R(x)y=R(x)Q(x)dx+cy=R(x)1(R(x)Q(x)dx+c)
R(x)称为积分因子 Integrate Factor
R ( x ) Q ( x ) = R ′ ( x ) R ( x ) = e ∫ P ( x ) d x R(x)Q(x)= R'(x) \\ R(x) = e^{\int P(x)dx} R(x)Q(x)=R(x)R(x)=eP(x)dx

3.3 Second Order ODE.s 二阶ODE

y ′ ′ = f ( x , y , y ′ ) y'' = f(x, y, y') y=f(x,y,y)

3.3.1 Simplest Cases 简单情况
  • 只有y’’, 没有y和y’:两次积分可以得到y
    y ′ ′ = f ( x ) → y = ∫ ∫ f ( x ) d x y'' = f(x) \rightarrow y= \int \int f(x)dx y=f(x)y=f(x)dx

  • 没有y:用P表示y’,用P’表示y’’,求解一阶ODE得到y’’
    y ′ ′ = f ( y ′ , x ) y'' = f(y', x) y=f(y,x)
    P = y ′ → y ′ ′ = P ′ = f ( P , x ) P=y' \rightarrow y''=P'=f(P,x) P=yy=P=f(P,x)
    得到一阶ODE得到P,积分得到y

  • 没有y’和x:用p表示y’, 链式求导得到y’’(y),求解一阶ODE得到p(y)
    y ′ ′ = f ( y ) y''=f(y) y=f(y)
    P = y ′ → y ′ ′ = P ′ = d p d y d y d x = p d p d y = f ( y ) P=y' \rightarrow y'' = P' = \frac{dp}{dy} \frac{dy}{dx} = p \frac{dp}{dy} = f(y) P=yy=P=dydpdxdy=pdydp=f(y)
    得到一阶ODE的分离形式,两边积分得到f(y’, y)=0形式的一阶ODE,再次求解

  • 没有x:用p表示y’, 链式求导得到y’’(y),求解一阶ODE
    y ′ ′ = f ( y ′ , y ) y'' = f(y', y) y=f(y,y)
    P = y ′ → y ′ ′ = P ′ = d p d y d y d x = p d p d y = f ( P , y ) P = y' \rightarrow y'' = P' = \frac{dp}{dy} \frac{dy}{dx} = p \frac{dp}{dy} = f(P,y) P=yy=P=dydpdxdy=pdydp=f(P,y)
    得到一阶ODE的第三种形式

3.3.2 Linear ODE.s of Order at least 2 二次及二次以上ODE

n阶线性方程的一般形式
∑ i = 0 n a i ( x ) y ( i ) ( x ) = g ( x ) \sum_{i=0}^{n} a_i(x)y^{(i)}(x) = g(x) i=0nai(x)y(i)(x)=g(x)

n阶线性微分算子
D ≡ d d x L = ∑ i = 0 n a i D i L   y = g ( x ) D \equiv \frac{d}{dx} \\ L = \sum_{i=0}^{n} a_i D^i \\ L \ y = g(x) \\ DdxdL=i=0naiDiL y=g(x)

L是线性操作符

Homogeneous
如果g(x) = 0, 则 L   y = 0 L \ y = 0 L y=0称为Homogeneous

L   y = g ( x ) L \ y = g(x) L y=g(x)的通解分为两部分 y = y c + y p y = y_c + y_p y=yc+yp
y c y_c yc称为 complimentary Function,是 L   y = 0 L \ y = 0 L y=0的解
y p y_p yp称为Paritcular Integral,是 L   y = g ( x ) L \ y = g(x) L y=g(x)的解

3.3.3 Linear ODE.s with Constant Coeffcients 常系数线性ODE

考虑Homogeneous情况: L   y = 0 L \ y = 0 L y=0
一阶 L   y = a y ′ + b y = 0 L \ y = ay' + by=0 L y=ay+by=0
二阶 L   y = a y ′ ′ + b y ′ + c y = 0 L \ y = ay'' + by' + cy = 0 L y=ay+by+cy=0

一阶方程的解为 y = e λ x y = e^{\lambda x} y=eλx
可以把一阶看作二阶的一个特例:也就是一阶方程的解应该也适用于二阶
将一阶方程的解代入二阶方程:
L ( e λ x ) = ( a λ 2 + b λ + c ) e λ x = 0 L(e^{\lambda x}) = (a \lambda ^2 + b \lambda + c)e^{\lambda x} = 0 L(eλx)=(aλ2+bλ+c)eλx=0
⟹ a λ 2 + b λ + c = 0 \Longrightarrow a \lambda ^2 + b \lambda + c = 0 aλ2+bλ+c=0 称为AUXILLIARY EQUATION (A.E)

  1. b 2 − 4 a c > 0 b^2-4ac > 0 b24ac>0 :
    y = c 1 e λ 1 x + c 2 e λ 2 x y=c_1 e^{\lambda_1 x} + c_2 e^{\lambda_2 x} y=c1eλ1x+c2eλ2x

  2. b 2 − 4 a c = 0 b^2-4ac = 0 b24ac=0 :
    除了 e λ x e^{\lambda x} eλx之外, x e λ x x e^{\lambda x} xeλx也是一个解
    y = c 1 e λ x + c 2 x e λ x y=c_1 e^{\lambda x} + c_2 x e^{\lambda x} y=c1eλx+c2xeλx

  3. b 2 − 4 a c < 0 b^2-4ac < 0 b24ac<0 :
    y = e p x ( A c o s   q x + B s i n   q x ) y = e^{px}(Acos \ qx + Bsin \ qx) y=epx(Acos qx+Bsin qx)
    p是实部,q是虚部

    • 看推导过程,要求A是实数,B是纯虚数,
    • 但是用通解代入时发现AB可以是任意数,不要求B为纯虚数
    • 由于推导过程使用的常数项 C 1 ,   C 2 C_1, \ C_2 C1, C2并不要求是实数,因此B可以不是纯虚数
    • 同样A也可以是虚数

3.4 General nth Order Equation n阶方程

L   y = ∑ a n y ( n ) ≡ 0 L = ∑ a n D n A . E . ⟹ ∑ a n λ n = 0 L\ y = \sum a_n y^{(n)} \equiv 0 \\ L = \sum a_n D^{n} \\ A.E. \Longrightarrow \sum a_n \lambda ^ n = 0 L y=any(n)0L=anDnA.E.anλn=0

A.E.解的种类

  1. n个不同实数解
    y = ∑ i = 1 n β i e λ i x y = \sum _{i=1}^{n} \beta _i e ^{\lambda_i x} y=i=1nβieλix

  2. 有n重实数根 λ \lambda λ
    y = e λ x ∑ i n α i x i − 1 y = e^{\lambda x} \sum_{i}^{n} \alpha_i x^{i - 1} y=eλxinαixi1

  3. 有n重共轭复数根 p ± i q p \pm iq p±iq
    e p x [ ( ∑ i = 1 n A i x i − 1 ) c o s   q x + ( ∑ i = 1 n B i x i − 1 ) s i n   q x ] e^{px}[(\sum_{i=1}^{n} A_i x^{i-1})cos \ qx + (\sum_{i=1}^{n} B_i x^{i-1})sin \ qx] epx[(i=1nAixi1)cos qx+(i=1nBixi1)sin qx]

  4. 以上三种情况的混合

3.5 Non-Homogeneous Case - Method of Undetermined Coefficients 非齐次

L   y = g ( x ) ,   g ( x ) ≠ 0 L \ y = g(x), \ g(x) \neq 0 L y=g(x), g(x)=0

L   y = L   ( y c + y p ) = L   y c + L   y p L \ y = L \ (y_c + y_p) \\ = L \ y_c + L \ y_p L y=L (yc+yp)=L yc+L yp

通解: y = C . F . + P . I y = C.F. + P.I y=C.F.+P.I

齐次项 L   y c L \ y_c L yc的通解 C . F C.F C.F 可以通过 A.E方程求解
非齐次项 L   y p L \ y_p L yp的特解 P . I P.I P.I 可以通过以下方法求解

  1. “Guesswork” - which we are interested in
  2. Annihilator
  3. D-operator Method

Guesswork Method,猜测

g(x)的形式:

  • 多项式
    g ( x ) = ∑ i = 0 m p i x i g(x) = \sum_{i=0}^{m} p_i x^{i} g(x)=i=0mpixi
    假设P.I的形式为 ∑ i = 0 m p i x i \sum_{i=0}^{m} p_i x^{i} i=0mpixi, 与g(x)的次数相同,代入方程求解系数,可得到 y p y_p yp

  • 指数函数
    g ( x ) = C e k x g(x) = Ce^{kx} g(x)=Cekx, 其中k不是A.E的解
    假设P.I的形式为 A e k x Ae^{kx} Aekx, 代入方程求解A,可得到 y p y_p yp

  • 三角函数
    g ( x ) = A s i n   a x + B c o s   a x g(x) = Asin\ ax + Bcos\ ax g(x)=Asin ax+Bcos ax, 其中ia不是A.E的解
    假设特解的形式为 R e ( K e i a ) Re(K e ^ {ia}) Re(Keia), 代入方程求解K,可得到 y p y_p yp(取实部)
    或者直接假设特解的形式为 A c o s   a x + B s i n   a x Acos\ ax + Bsin\ ax Acos ax+Bsin ax,求解A和B

  • 以上三种的组合

3.5.1 Failure Case 不可直接求解的形式

g ( x ) = C e k x g(x) = Ce^{kx} g(x)=Cekx, 其中k是A.E的根,

  • 假设解为 A e k x Ae^{kx} Aekx,代入方程后,左边为0,无法求解
  • 假设解为 A x r e k x Ax^re^{kx} Axrekx, r表示k是A.E的r重根(低次项已经包含齐次项通解中,不需要再求系数,也无法求解)

3.6 Linear ODE.s with Variable Coefficients - Euler Equation 可变系数的线性ODE - (柯西-)欧拉方程

Cauchy-Euler equation 柯西-欧拉方程:系数中x的次数,与微分的阶数相同
L   y = ∑ i = 0 n a i x i y ( i ) = g ( x ) L \ y = \sum_{i = 0}^{n} a_i x^i y^{(i)} = g(x) L y=i=0naixiy(i)=g(x)

考虑二阶的情况,先求解齐次项,假设 y = x λ y = x^{\lambda} y=xλ,代入方程得到
a λ 2 + ( b − a ) λ + c = 0 a \lambda^2 + (b-a) \lambda + c = 0 aλ2+(ba)λ+c=0,三种情况:

  • 两个实数解: y = A x λ 1 + B x λ 2 y = Ax^{\lambda_1} + Bx^{\lambda_2} y=Axλ1+Bxλ2
  • 二重根: y = x λ ( A + B l n   x ) y = x^{\lambda}(A + Bln \ x) y=xλ(A+Bln x)
  • 共轭虚数根 y = x α ( A c o s ( β l n   x ) + B s i n ( β l n   x ) ) y = x^{\alpha}(Acos(\beta ln\ x) + Bsin(\beta ln\ x)) y=xα(Acos(βln x)+Bsin(βln x))
    x ± i β = e l n ( x ± i β ) = e ± i β l n   x = e ± i θ θ = β l n   x x^{\pm i \beta } = e ^ { ln(x^{\pm i \beta}) } = e^{\pm i \beta ln \ x} = e^{\pm i \theta} \\ \theta = \beta ln \ x x±iβ=eln(x±iβ)=e±iβln x=e±iθθ=βln x
3.6.1 Reduction to constant coefficient 退化为常系数方程

令 x = e t ,   t = l n   x y ′ = d y d t × d t d x = 1 x × d t d x y ′ ′ = 1 x 2 ( d 2 y d t 2 − d y d t ) 令x = e^t, \ t = ln \ x \\ y' = \frac{dy}{dt} \times \frac{dt}{dx} = \frac{1}{x} \times \frac{dt}{dx} \\ y'' = \frac{1}{x^2}(\frac{d^2 y}{dt^2} - \frac{dy}{dt}) x=et, t=ln xy=dtdy×dxdt=x1×dxdty=x21(dt2d2ydtdy)
代入柯西-欧拉方程,刚好可以消去可变项,得到常系数方程

按常系数方程求解通解和特解,再用 t = l n   x t = ln \ x t=ln x替换

3.7 Partial Differential Equations 偏微分方程(略)

1 Probability 概率

1.1 Preliminaries 知识准备

  • experiment 实验:可重复,可产生一组输出的过程
  • event 事件:一个或多个输出的集合
  • sample space 样本空间:所有输出的集合,记作 Ω \Omega Ω

例子:掷六面色子
样本空间 Ω = { 1 , 2 , 3 , 4 , 5 , 6 } \Omega = \{1, 2, 3, 4, 5, 6\} Ω={1,2,3,4,5,6}
事件

  • 掷出偶数: E 1 = { 2 , 4 , 6 } E_1 = \{2, 4, 6\} E1={2,4,6}
  • 掷出奇数: E 1 = { 1 , 3 , 5 } E_1 = \{1, 3, 5\} E1={1,3,5}
  • 掷出素数: E 1 = { 2 , 3 , 5 } E_1 = \{2, 3, 5\} E1={2,3,5}
1.1.1 Probability Scale 概率度量

事件E发生的概率P(E)满足条件 0 ≤ P ( E ) ≤ 1 0 \le P(E) \le 1 0P(E)1

1.1.2 Probability of an Event 事件概率

事件E发生的概率定义为

P ( E ) = 事 件 E 发 生 的 次 数 所 有 输 出 发 生 的 总 次 数 P(E) = \frac{事件E发生的次数}{所有输出发生的总次数} P(E)=E

1.1.3 The Complimentary Event E’ 事件E的补集

E’表示E不发生,概率为 P ( E ′ ) = 1 − P ( E ) P(E') = 1 - P(E) P(E)=1P(E)

1.2 Probability Diagrams 用图表表示概率

三种表示方法

  • 样本空间或二维表格
    用两个色子掷出8的概率 P ( 8 ) = 5 36 P(8)=\frac{5}{36} P(8)=365
    用两个色子掷出8的概率

  • 树型图
    4红,5黄,11蓝,每次取出后放回,取两次,取出1个红球,1个蓝球的概率
    4 20 × 11 20 + 11 20 × 4 20 = 11 50 \frac{4}{20} \times \frac{11}{20} + \frac{11}{20} \times \frac{4}{20} = \frac{11}{50} 204×2011+2011×204=5011
    树形图

  • Venn Diagram 文氏图:计算并集、交集、条件概率
    文氏图

1.3 Conditional Probability 条件概率

给定事件A发生的情况下,事件B发生的概率。记作 P ( B ∣ A ) P(B|A) P(BA)

P ( A ∣ B ) = P ( A ∩ B ) P ( B ) P ( A ∩ B ) = P ( A ∣ B ) × P ( B ) P(A|B)=\frac{P(A \cap B)}{P(B)} \\ P(A \cap B) = P(A|B) \times P(B) P(AB)=P(B)P(AB)P(AB)=P(AB)×P(B)

Bayes’ Theorem

P ( A ∩ B ) = P ( B ∩ A ) P ( A ∣ B ) × P ( B ) = P ( B ∣ A ) × P ( A ) P ( B ∣ A ) = P ( A ∣ B ) × P ( B ) P ( A ) P(A \cap B) = P(B \cap A) \\ P(A|B) \times P(B) = P(B|A) \times P(A) \\ P(B|A) = \frac{P(A|B) \times P(B)}{P(A)} P(AB)=P(BA)P(AB)×P(B)=P(BA)×P(A)P(BA)=P(A)P(AB)×P(B)

例子:10个硬币,9个普通硬币(一正一反),1个特殊硬币(两个正面),从中取出一个硬币,放5次,问题

  1. 取到5个正面的概率
    取到普通硬币的概率 P ( N ) = 9 10 P(N) = \frac{9}{10} P(N)=109
    取到普通硬币后,得到正面的概率 P ( H ∣ N ) = 1 2 P(H|N) = \frac{1}{2} P(HN)=21
    取到特殊硬币的概率 P ( S ) = 1 − P ( N ) = 1 10 P(S) = 1 - P(N) = \frac{1}{10} P(S)=1P(N)=101
    取到特殊硬币后,得到正面的概率 P ( H ∣ S ) = 1 P(H|S) = 1 P(HS)=1
    P ( 5   H e a d s ) = 9 10 × ( 1 2 ) 5 + 1 10 × 1 5 = 41 320 P(5 \ Heads) = \frac{9}{10} \times (\frac{1}{2})^5 + \frac{1}{10} \times 1^5 = \frac{41}{320} P(5 Heads)=109×(21)5+101×15=32041

  2. 取到5个正面时,这个硬币是特殊硬币的概率

P ( S ∣ 5   H e a d s ) = P ( 5   H e a d s ∣ S ) × P ( S ) P ( 5   H e a d s ) = 1 × 1 10 41 320 = 32 41 P(S | 5 \ Heads) = \frac{P(5 \ Heads | S) \times P(S)}{P(5 \ Heads)} = \frac{1 \times \frac{1}{10}}{\frac{41}{320}} = \frac{32}{41} P(S5 Heads)=P(5 Heads)P(5 HeadsS)×P(S)=320411×101=4132

1.4 Mutually exclusive and Independent events 互斥和独立

互斥:
P ( A ∩ B ) = 0 P(A \cap B) = 0 P(AB)=0
P ( A ∪ B ) = P ( A ) + P ( B ) P(A \cup B) = P(A) + P(B) P(AB)=P(A)+P(B)

独立:
P ( A ∩ B ) = P ( A ) × P ( B ) P(A \cap B) = P(A) \times P(B) P(AB)=P(A)×P(B)
P ( A ∣ B ) = P ( A ) P(A|B) = P(A) P(AB)=P(A)

1.5 Two famous problems

Birthday Problem:60个人中至少两个人是同一个生日的概率

所有人生日都不相同的概率 P = 365 × 364 × ⋯ × 306 36 5 60 P = \frac{365 \times 364 \times \cdots \times 306}{365 ^ {60}} P=36560365×364××306
有至少两个人生日相同的概率为 1 − P = 0.5 1-P = 0.5% 1P=0.5

Monty Hall Game Show:ABC三个门,其中一个里面有车,另外两个有山羊,甲随机选了一个门,主持人去掉一个有山羊的门,这时候甲应该改变选择吗?

问题的关键在于主持人知道哪个门后面有车

1.6 Random Variables 随机变量

1.6.1 Notation 术语

随机变量: X ,   Y ,   Z X, \ Y, \ Z X, Y, Z
观察变量: x ,   y ,   z x, \ y, \ z x, y, z

1.6.2 Definition 定义

值空间不一定都是数值,进行从值空间到数轴的映射

1.6.3 Types of Random variable 随机变量的种类
  • 离散:值可数
  • 连续:值不可数

1.7 Probability Distributions 概率分布

1.7.1 Discrete distributions 离散分布

同时掷两个色子,和的概率分布
离散概率分布

1.7.2 Continuous Distributions 连续分布

单个值的概率分布为0 P ( X = x ) = 0 P(X=x)=0 P(X=x)=0

用PDF描述概率:Probablity Density Function
P ( a < X < b ) = ∫ a b f ( x ) d x P(a \lt X \lt b) = \int _a^b f(x) dx P(a<X<b)=abf(x)dx

PDF的特性:

  • f ( x ) ≥ 0 f(x) \ge 0 f(x)0
  • ∫ − ∞ ∞ f ( x ) d x = 1 \int _{-\infty}^{\infty} f(x) dx = 1 f(x)dx=1
  • P ( a < X < b ) = ∫ a b f ( x ) d x P(a \lt X \lt b) = \int _a^b f(x) dx P(a<X<b)=abf(x)dx

1.8 Cumulative Distribution Function CDF 累积分布函数

概率累积: F ( x ) = P ( X ≤ x ) F(x) = P(X \le x) F(x)=P(Xx)

1.8.1 Discrete Random variables

对小于x的值的概率进行累加

1.8.2 Continuous Random variables 连续随机变量

F ( x ) = P ( X ≤ x ) = ∫ − ∞ x f ( t ) d t F(x) = P(X \le x) = \int_{-\infty}^{x} f(t)dt F(x)=P(Xx)=xf(t)dt

1.9 Expectation and Variance 期望和方差

期望: E ( X ) = μ E(X) = \mu E(X)=μ,描述分布均值
方差: V ( X ) = σ 2 V(X) = \sigma^2 V(X)=σ2,描述分布离散程度

1.9.1 Discrete Random variables 离散随机变量

E ( X ) = ∑ a l l   x x P ( X = x ) E(X) = \sum_{all \ x} xP(X=x) E(X)=all xxP(X=x)
V ( X ) = E ( X − E ( X ) ) = E ( X 2 ) − ( E ( X ) ) 2 V(X) = E(X - E(X)) = E(X^2) - (E(X))^2 V(X)=E(XE(X))=E(X2)(E(X))2

1.9.2 Continuous Random Variables 连续随机变量

E ( X ) = ∫ a l l   x x f ( x ) d x E(X) = \int_{all \ x} xf(x)dx E(X)=all xxf(x)dx
V ( X ) = E [ ( X − E ( X ) ) 2 ] = E ( X 2 ) − ( E ( X ) ) 2 = ∫ a l l   x x 2 f ( x ) d x − ( ∫ a l l   x x f ( x ) d x ) 2 V(X) = E[(X - E(X))^2] = E(X^2) - (E(X))^2 = \int_{all \ x} x^2 f(x)dx - (\int_{all \ x} xf(x)dx)^2 V(X)=E[(XE(X))2]=E(X2)(E(X))2=all xx2f(x)dx(all xxf(x)dx)2

1.10 Expectation Algebra 期望值的代数运算

期望是线性操作
E ( X + a ) = E ( X ) + a E ( a X ) = a E ( X ) E ( X + Y ) = E ( X ) + E ( Y ) E(X + a) = E(X) +a \\ E(aX) = aE(X) \\ E(X + Y) = E(X) + E(Y) \\ E(X+a)=E(X)+aE(aX)=aE(X)E(X+Y)=E(X)+E(Y)
V ( X + a ) = V ( X ) V ( a X ) = a 2 V ( X ) V ( b ) = 0 V(X + a) = V(X) \\ V(aX) = a^2V(X) \\ V(b) = 0 \\ V(X+a)=V(X)V(aX)=a2V(X)V(b)=0

如果X和Y独立
E ( X Y ) = E ( X ) E ( Y ) V ( X + Y ) = V ( X ) + V ( Y ) E(XY) = E(X)E(Y) \\ V(X + Y) = V(X) + V(Y) \\ E(XY)=E(X)E(Y)V(X+Y)=V(X)+V(Y)

如果不独立
V ( X + Y ) = V ( X ) + V ( Y ) + 2 E [ ( X − E ( X ) ) ( Y − E ( Y ) ] C o v ( X , Y ) = E [ ( X − E ( X ) ) ( Y − E ( Y ) ] V(X + Y) = V(X) + V(Y) + 2E[(X-E(X))(Y-E(Y)] \\ Cov(X, Y) = E[(X-E(X))(Y-E(Y)] V(X+Y)=V(X)+V(Y)+2E[(XE(X))(YE(Y)]Cov(X,Y)=E[(XE(X))(YE(Y)]

1.11 Moments 矩

一阶矩 E ( X ) = μ E(X) = \mu E(X)=μ
n阶矩 E ( X n ) = ∫ a l l   x x n f ( x ) d x E(X^n) = \int_{all \ x} x^n f(x) dx E(Xn)=all xxnf(x)dx

中心距

  • 二阶中心矩:方差 V ( X ) = E [ ( X − E ( X ) ) 2 ] = σ 2 V(X) = E[(X - E(X)) ^ 2] = \sigma^2 V(X)=E[(XE(X))2]=σ2

  • 三阶中心距: E [ ( X − E ( X ) ) 3 ] E[(X-E(X))^3] E[(XE(X))3]

  • 偏度(三阶归一化中心距):度量非对称性
    S k e w n e s s = E [ ( X − E ( X ) )   3 ] σ 3 Skewness = \frac {E[(X-E(X)) \ ^3]}{\sigma ^ 3} Skewness=σ3E[(XE(X)) 3]

  • 尾度(四阶归一化中心距):度量肥尾特性
    K u r t o s i s = E [ ( X − E ( X ) )   4 ] σ 4 Kurtosis= \frac {E[(X-E(X)) \ ^4]}{\sigma ^ 4} Kurtosis=σ4E[(XE(X)) 4]

    • kurtosis越大,表示尾部数据的概率分布越高(fat tail 肥尾)
    • 正态分布的kurtosis为3
    • Leptokurtic: kurtosis大于3,PDF图像呈现尖峰肥尾
    • Platykurtic: kurtosis小于3,PDF图像比较平坦

1.12 Covariance 协方差

如果X和Y独立 E ( X Y ) = E ( X ) E ( Y ) E(XY) = E(X)E(Y) E(XY)=E(X)E(Y)$

协方差: C o v ( X , Y ) = E [ ( X − E ( X ) ) ( Y − E ( Y ) ] = E ( X Y ) − E ( X ) E ( Y ) Cov(X, Y) = E[(X-E(X))(Y-E(Y)] = E(XY) - E(X)E(Y) Cov(X,Y)=E[(XE(X))(YE(Y)]=E(XY)E(X)E(Y)

相关性:
ρ X Y = C o v ( X , Y ) σ X σ Y \rho _{XY} = \frac{Cov(X, Y)}{\sigma_X \sigma_Y} ρXY=σXσYCov(X,Y)

ρ X Y \rho _{XY} ρXY 等于-1,负相关,反向变化,等于1,正相关,同向变化,等于0,不相关

1.13 Important Distributions 重要分布

这些概率分布适用于对不同的对象进行建模

1.13.1 Binomial Distribution 二项式分布

多次伯努利实验的累积

  • 实验次数为n
  • 实验之间相互独立
  • 成功概率(=1的概率)为p

X ∼ B ( n , p ) P ( X = x ) = C x n p x ( 1 − p ) n − x C x n = n ! x ! ( n − x ) ! E ( X ) = n p V ( X ) = n p ( 1 − p ) \begin{aligned} X & \sim B(n, p) \\ P(X=x) & = C_x^n p^x(1-p)^{n-x} \\ C_x^n& = \frac{n!}{x!(n-x)!} \\ E(X) & = np \\ V(X) & = np(1-p) \end{aligned} XP(X=x)CxnE(X)V(X)B(n,p)=Cxnpx(1p)nx=x!(nx)!n!=np=np(1p)

1.13.2 Poisson Distribution 泊松分布

泊松分布:对违约个数进行建模

  • 两个事件同时发生时,没有影响
  • 事件之间相互独立
  • 事件在所有时间点发生的概率相同

X ∼ P o ( λ ) P ( X = r ) = e − λ λ r r ! ,   w h e r e   r = 0 , 1 , 2 , ⋯ E ( X ) = λ V ( X ) = λ \begin{aligned} X & \sim Po(\lambda) \\ P(X=r) & = \frac{e^{-\lambda}\lambda^r} {r!}, \ where \ r = 0, 1, 2, \cdots \\ E(X) & = \lambda \\ V(X) & = \lambda \end{aligned} XP(X=r)E(X)V(X)Po(λ)=r!eλλr, where r=0,1,2,=λ=λ

1.13.3 Normal Distribution 正态分布

正态分布时最常用连续分布

X ∼ N ( μ , σ 2 ) E ( X ) = μ V ( X ) = σ 2 P D F = f ( x ) = 1 σ 2 π e − ( x − μ ) 2 2 σ 2 C D F = P ( X ≤ x ) = ∫ − ∞ x 1 σ 2 π e − ( s − μ ) 2 2 σ 2 d s ∫ − ∞ ∞ 1 σ 2 π e ( x − μ ) 2 2 σ 2 d x = 1 \begin{aligned} X & \sim N(\mu, \sigma^2) \\ E(X) & = \mu \\ V(X) & = \sigma^2 \\ PDF=f(x) & = \frac{1}{\sigma\sqrt{2\pi}} e^{- \frac{(x-\mu)^2}{2\sigma^2} } \\ CDF=P(X \leq x) & = \int_{-\infty}^{x}\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(s-\mu)^2}{2\sigma^2}}ds \\ \int_{-\infty}^{\infty}\frac{1}{\sigma\sqrt{2\pi}}e^{\frac{(x-\mu)^2}{2\sigma^2}}dx & = 1 \\ \end{aligned} XE(X)V(X)PDF=f(x)CDF=P(Xx)σ2π 1e2σ2(xμ)2dxN(μ,σ2)=μ=σ2=σ2π 1e2σ2(xμ)2=xσ2π 1e2σ2(sμ)2ds=1

1.13.4 Standard Normal distribution 标准正态分布(z分布)

Z ∼ N ( 0 , 1 ) E ( X ) = 0 V ( X ) = 1 P D F = f ( z ) = 1 2 π e − z 2 2 C D F = Φ ( z ) = ∫ − ∞ z 1 2 π e − s 2 2 d s Z = X − μ σ \begin{aligned} Z & \sim N(0, 1) \\ E(X) & = 0 \\ V(X) & = 1 \\ PDF=f(z) & = \frac{1}{\sqrt{2\pi}}e^{- \frac{z^2}{2}} \\ CDF=\Phi(z) & = \int_{-\infty}^{z}\frac{1}{\sqrt{2\pi}}e^{- \frac{s^2}{2}}ds \\ Z & = \frac{X - \mu}{\sigma} \end{aligned} ZE(X)V(X)PDF=f(z)CDF=Φ(z)ZN(0,1)=0=1=2π 1e2z2=z2π 1e2s2ds=σXμ

1.13.5 Common regions 常用区间

正态分布的区间概率

区间概率
± σ \pm\sigma ±σ68%
± 2 σ \pm2\sigma ±2σ95%
± 3 σ \pm3\sigma ±3σ99.8%

1.14 Central Limit Theorem 中心极限定理

X 1 , X 2 , ⋯   , X n X_1, X_2, \cdots, X_n X1,X2,,Xn独立同分布(independent same distribution, iid)的随机变量

样本均值 X ˉ = ∑ i = 1 n X i n \bar X = \frac{\sum_{i=1}^{n}X_i}{n} Xˉ=ni=1nXi符合正态分布

  • X的分布可以是任意分布
  • 只需要很小的n就可以产生正态分布
  • Total and means are quantities of interest

E ( X ˉ ) = μ V ( X ˉ ) = σ 2 / n X ˉ ∼ N ( μ , σ 2 ) X ˉ − μ σ n ∼ N ( 0 , 1 ) \begin{aligned} E(\bar X) & = \mu \\ V(\bar X) & = \sigma^2/n \\ \bar X & \sim N(\mu, \sigma^2) \\ \frac{\bar X - \mu}{\sigma \sqrt{n}} & \sim N(0, 1) \end{aligned} E(Xˉ)V(Xˉ)Xˉσn Xˉμ=μ=σ2/nN(μ,σ2)N(0,1)

2 Statistics 统计

2.1 Sampling 采样

采样的权重(概率)都是 1 N \frac{1}{N} N1

总体
μ = 1 N ∑ i = 1 N x i σ 2 = 1 N ∑ i = 1 N ( x i − μ ) 2 \begin{aligned} \mu & = \frac{1}{N}\sum_{i=1}^{N}x_i \\ \sigma^2 & = \frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2 \end{aligned} μσ2=N1i=1Nxi=N1i=1N(xiμ)2

样本
X ˉ = 1 n ∑ i = 1 n x i E ( X ˉ ) = μ S 2 = 1 n − 1 ∑ i = 1 n ( x i − x ˉ ) 2 E ( s 2 ) = σ 2 \begin{aligned} \bar X & = \frac{1}{n}\sum_{i=1}^{n}x_i \\ E(\bar X) & = \mu \\ S^2 & = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar x)^2 \\ E(s^2) & = \sigma^2 \end{aligned} XˉE(Xˉ)S2E(s2)=n1i=1nxi=μ=n11i=1n(xixˉ)2=σ2

2.1.1 Proof 证明

独立同分布假设可以得到 V ( ∑ i = 1 n x i ) = n σ 2 V(\sum_{i=1}^nx_i) = n\sigma^2 V(i=1nxi)=nσ2

根据中心极限定理,得到:
E ( X ˉ ) = μ V ( X ˉ ) = σ 2 n V ( X ˉ ) = E ( X ˉ 2 ) − [ E ( X ˉ ) ] 2 ⟹ E ( X ˉ 2 ) = σ 2 n + μ 2 令 n = 1 ⟹ E ( X i 2 ) = σ 2 + μ 2 E ( S 2 ) = 1 n − 1 E [ ∑ ( X i − X ˉ ) 2 ] = 1 n − 1 E [ ∑ X i 2 − n X ˉ 2 ] = 1 n − 1 ∑ E ( X i 2 ) − n [ E ( X ˉ ) ] 2 = 1 n − 1 ( n ( σ 2 + μ 2 ) − n ( σ 2 n + μ 2 ) ) = σ 2 \begin{aligned} E(\bar X) & = \mu \\ V(\bar X) & = \frac{\sigma ^ 2}{n} \\ V(\bar X) & = E(\bar X^2) - [E(\bar X)]^2 \Longrightarrow E(\bar X^2) & = \frac{\sigma^2}{n} + \mu^2 \\ 令n=1 \Longrightarrow E(X_i^2) & = {\sigma^2} + \mu^2 \\ E(S^2) & = \frac{1}{n-1}E[\sum(X_i - \bar X)^2] \\ & = \frac{1}{n-1}E[\sum X_i^2 - n \bar X^2] \\ & = \frac{1}{n-1}\sum E(X_i^2) - n[E(\bar X)]^2 \\ & = \frac{1}{n-1}(n({\sigma^2} + \mu^2) - n ( \frac{\sigma^2}{n} + \mu^2)) = \sigma ^2 \\ \end{aligned} E(Xˉ)V(Xˉ)V(Xˉ)n=1E(Xi2)E(S2)=μ=nσ2=E(Xˉ2)[E(Xˉ)]2E(Xˉ2)=σ2+μ2=n11E[(XiXˉ)2]=n11E[Xi2nXˉ2]=n11E(Xi2)n[E(Xˉ)]2=n11(n(σ2+μ2)n(nσ2+μ2))=σ2=nσ2+μ2

2.2 Maximum Likelihood Estimation 极大似然估计 MLE

  • 统计方法
  • 用数据拟合模型

用观测值估计模型的参数:按照给定的数据,什么样的模型参数可能会给出这样的数据

2.2.1 Motivating example
  • 先假设数据服从某个分布(带参数的分布),例如二项式分布
  • 观测一组数据(独立同分布)
  • 将数据代入似然函数(分布函数),求解使得似然函数取最大值的参数

求梯度得到极值对应的参数值

2.2.2 In General

l ( θ ; x 1 , x 2 , x 3 , ⋯   , x n ) = f ( x 1 , x 2 , x 3 , ⋯   , x n ; θ ) L ( θ ; x 1 , x 2 , x 3 , ⋯   , x n ) = l o g   l ( θ ; x 1 , x 2 , x 3 , ⋯   , x n ) \begin{aligned} l(\theta; x_1, x_2, x_3, \cdots, x_n) & = f(x_1, x_2, x_3, \cdots, x_n; \theta) \\ L(\theta; x_1, x_2, x_3, \cdots, x_n) & = log \ l(\theta; x_1, x_2, x_3, \cdots, x_n) \end{aligned} l(θ;x1,x2,x3,,xn)L(θ;x1,x2,x3,,xn)=f(x1,x2,x3,,xn;θ)=log l(θ;x1,x2,x3,,xn)
目标:找到使得L最大的参数 θ \theta θ

2.2.3 Normal Distribution

估算 μ 和 σ \mu和\sigma μσ

假设

  • X ∼ N ( μ , σ 2 ) X \sim N(\mu, \sigma^2) XN(μ,σ2), i.e. f ( x ) = 1 σ 2 π e − ( x − μ ) 2 2 σ 2 f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}} f(x)=σ2π 1e2σ2(xμ)2
  • x 1 , x 2 , x 3 , ⋯   , x n x_1, x_2, x_3, \cdots, x_n x1,x2,x3,,xn是iid的随机采样

L ( μ , σ ; x 1 , x 2 , x 3 , ⋯   , x n ) = l o g   l ( μ , σ ; x 1 , x 2 , x 3 , ⋯   , x n ) = l o g   f ( x 1 , x 2 , x 3 , ⋯   , x n ; μ , σ ) = l o g ∏ i = 1 n f ( x i ; μ , σ ) = ∑ i = 1 n l o g f ( x i ; μ , σ ) = ∑ i = 1 n l o g ( 1 σ 2 π e − ( x i − μ ) 2 2 σ 2 ) = ∑ i = 1 n ( l o g ( 1 σ 2 π ) − ( x i − μ ) 2 2 σ 2 ) = − n 2 l o g ( 2 π ) − n l o g ( σ ) − 1 2 σ 2 ∑ i = 1 n ( x i − μ ) 2 \begin{aligned} & L(\mu, \sigma; x_1, x_2, x_3, \cdots, x_n) \\ = & log \ l(\mu, \sigma; x_1, x_2, x_3, \cdots, x_n) \\ = & log \ f(x_1, x_2, x_3, \cdots, x_n; \mu, \sigma) \\ = & log \prod_{i=1}^n f(x_i; \mu, \sigma) \\ = & \sum_{i=1}^n logf(x_i; \mu, \sigma) \\ = & \sum_{i=1}^n log(\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(x_i-\mu)^2}{2\sigma^2}}) \\ = & \sum_{i=1}^n (log(\frac{1}{\sigma\sqrt{2\pi}})-\frac{(x_i-\mu)^2}{2\sigma^2}) \\ = & -\frac{n}{2}log(2\pi)-nlog(\sigma)-\frac{1}{2\sigma^2}\sum_{i=1}^n(x_i - \mu)^2 \end{aligned} =======L(μ,σ;x1,x2,x3,,xn)log l(μ,σ;x1,x2,x3,,xn)log f(x1,x2,x3,,xn;μ,σ)logi=1nf(xi;μ,σ)i=1nlogf(xi;μ,σ)i=1nlog(σ2π 1e2σ2(xiμ)2)i=1n(log(σ2π 1)2σ2(xiμ)2)2nlog(2π)nlog(σ)2σ21i=1n(xiμ)2

μ \mu μ σ \sigma σ求偏微分,得到的解为
μ = 1 n ∑ i = 1 n x i σ = 1 n ∑ i = 1 n ( x i − μ ) 2 \begin{aligned} \mu &= \frac{1}{n}\sum_{i=1}^n x_i \\ \sigma &= \frac{1}{n}\sum_{i=1}^n (x_i - \mu)^2 \end{aligned} μσ=n1i=1nxi=n1i=1n(xiμ)2

2.3 Regression and Correlation 回归和相关性

2.3.1 Linear regression 线性回归

两变量 y = a x + b y=ax+b y=ax+b, 计算系数a和b使得回归误差最小

2.3.2 Correlation 相关系数
2.3.3 Pearson Product-Moment Correlation Coefficient

P M C C   r = s x y S x x S y y PMCC \ r = \frac{s_{xy}}{\sqrt{S_{xx}S_{yy}}} PMCC r=SxxSyy sxy

2.3.4 Spearman’s Rank Correlation Coefficient 基于排序的相关性

2.4 Time Series 时间序列

两种方法对时间序列建模

  • Simple moving average:MA 简单移动平均
  • Auto Regressive :AR 自回归
2.4.1 Moving Average
  • 6
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值