一元函数泰勒展开

若函数f(x)在包含 x 0 x_0 x0的某个开区间 (a,b)上具有(n +1)阶导数,那么对于任意 x ∈ ( a , b ) x \in (a,b) x(a,b),有:

f ( x ) ≈ f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! ( x − x 0 ) + f ′ ′ ( x 0 ) 2 ! ( x − x 0 ) 2 + ⋅ ⋅ ⋅ + f ( n + 1 ) ( x 0 ) ( n + 1 ) ! ( x − x 0 ) ( n + 1 ) f(x) \approx \frac {f(x_0)}{0!} + \frac{f'(x_0)}{1!}(x - x_0) + \frac{f''(x_0)}{2!}(x - x_0)^2 + ··· + \frac{f^{(n+1)}(x_0)}{(n+1)!}(x - x_0)^{(n+1)} f(x)0!f(x0)+1!f(x0)(xx0)+2!f′′(x0)(xx0)2+⋅⋅⋅+(n+1)!f(n+1)(x0)(xx0)(n+1)

阶乘复习:

n ! = ( n + 1 ) ! / ( n + 1 ) n! = (n+1)!/(n+1) n!=(n+1)!/(n+1)

3 ! = 4 ! / 4 3! = 4!/4 3!=4!/4

2 ! = 3 ! / 3 2! = 3!/3 2!=3!/3

1 ! = 2 ! / 2 1! = 2!/2 1!=2!/2

0 ! = 1 ! / 1 = 1 0! = 1!/1 = 1 0!=1!/1=1

上述泰勒公式,是一个用函数在某点的信息描述其附近取值的公式。如果函数满足一定的条件,泰勒公式可以用函数在某一点的各阶导数值做系数构建一个多项式来近似表达这个函数。

变换一下:
f ( x ) = f ( x 0 + ( x − x 0 ) ) f(x) = f(x_0 + (x - x_0)) f(x)=f(x0+(xx0)) ( x − x 0 ) 表示微小差值: Δ x (x - x_0)表示微小差值:\Delta{x} (xx0)表示微小差值:Δx

那么,上面泰勒公式可以转换成:
f ( x 0 + ( x − x 0 ) ) ≈ f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! ( x − x 0 ) + f ′ ′ ( x 0 ) 2 ! ( x − x 0 ) 2 + ⋅ ⋅ ⋅ + f ( n + 1 ) ( x 0 ) ( n + 1 ) ! ( x − x 0 ) ( n + 1 ) = f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! Δ x + f ′ ′ ( x 0 ) 2 ! Δ x 2 + ⋅ ⋅ ⋅ + f ( n + 1 ) ( x 0 ) ( n + 1 ) ! Δ x ( n + 1 ) f(x_0 + (x - x_0)) \approx \frac {f(x_0)}{0!} + \frac{f'(x_0)}{1!}(x - x_0) + \frac{f''(x_0)}{2!}(x - x_0)^2 + ··· + \frac{f^{(n+1)}(x_0)}{(n+1)!}(x - x_0)^{(n+1)}\\=\frac {f(x_0)}{0!} + \frac{f'(x_0)}{1!}\Delta{x} + \frac{f''(x_0)}{2!}\Delta{x}^2 + ··· + \frac{f^{(n+1)}(x_0)}{(n+1)!}\Delta{x}^{(n+1)} f(x0+(xx0))0!f(x0)+1!f(x0)(xx0)+2!f′′(x0)(xx0)2+⋅⋅⋅+(n+1)!f(n+1)(x0)(xx0)(n+1)=0!f(x0)+1!f(x0)Δx+2!f′′(x0)Δx2+⋅⋅⋅+(n+1)!f(n+1)(x0)Δx(n+1)

f ( x 0 + Δ x ) ≈ f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! Δ x + f ′ ′ ( x 0 ) 2 ! Δ x 2 + ⋅ ⋅ ⋅ + f ( n + 1 ) ( x 0 ) ( n + 1 ) ! Δ x ( n + 1 ) f(x_0 + \Delta{x}) \approx \frac {f(x_0)}{0!} + \frac{f'(x_0)}{1!}\Delta{x} + \frac{f''(x_0)}{2!}\Delta{x}^2 + ··· + \frac{f^{(n+1)}(x_0)}{(n+1)!}\Delta{x}^{(n+1)} f(x0+Δx)0!f(x0)+1!f(x0)Δx+2!f′′(x0)Δx2+⋅⋅⋅+(n+1)!f(n+1)(x0)Δx(n+1)

得到下面形式公式:
f ( x + Δ x ) ≈ f ( x ) 0 ! + f ′ ( x ) 1 ! Δ x + f ′ ′ ( x ) 2 ! Δ x 2 + ⋅ ⋅ ⋅ + f ( n + 1 ) ( x ) ( n + 1 ) ! Δ x ( n + 1 ) f(x + \Delta{x}) \approx \frac {f(x)}{0!} + \frac{f'(x)}{1!}\Delta{x} + \frac{f''(x)}{2!}\Delta{x}^2 + ··· + \frac{f^{(n+1)}(x)}{(n+1)!}\Delta{x}^{(n+1)} f(x+Δx)0!f(x)+1!f(x)Δx+2!f′′(x)Δx2+⋅⋅⋅+(n+1)!f(n+1)(x)Δx(n+1)

泰勒展开可以用来研究函数某些性质。在机器学习里面,用来求函数的极值,很多时候函数 f(x)可能会非常复杂,无法直接计算,可用泰勒展开做近似计算。
梯度下降法怎么做的呢?是做一个近似,保留泰勒展开一阶项。
而牛顿法是保留泰勒展开二阶项,忽略二阶以上的项,用泰勒二阶展开来进行函数f(x)近似表达

一阶泰勒公式:

f ( x + Δ x ) ≈ f ( x ) 0 ! + f ′ ( x ) 1 ! Δ x f(x + \Delta{x}) \approx \frac {f(x)}{0!} + \frac{f'(x)}{1!}\Delta{x} f(x+Δx)0!f(x)+1!f(x)Δx

二阶泰勒公式:

f ( x + Δ x ) ≈ f ( x ) 0 ! + f ′ ( x ) 1 ! Δ x + f ′ ′ ( x ) 2 ! Δ x 2 f(x + \Delta{x}) \approx \frac {f(x)}{0!} + \frac{f'(x)}{1!}\Delta{x} + \frac{f''(x)}{2!}\Delta{x}^2 f(x+Δx)0!f(x)+1!f(x)Δx+2!f′′(x)Δx2

你可能感兴趣的:(机器学习基础,机器学习,人工智能,泰勒展开,泰勒公式)