AI笔记: 数学基础之泰勒Taylor公式的变形和应用

    技术2025-06-05  23

    泰勒公式的变形

    我们知道泰勒公式是这样的: f ( x ) = f ( x 0 ) 0 ! + f ′ ( x 0 ) 1 ! ( x − x 0 ) + f ′ ′ ( x 0 ) 2 ! ( x − x 0 ) 2 + . . . + f ( n ) ( x 0 ) n ! ( x − x 0 ) n + R n ( x ) f(x) = \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)(x_0)}}{n!}(x-x_0)^n + R_n(x) f(x)=0!f(x0)+1!f(x0)(xx0)+2!f(x0)(xx0)2+...+n!f(n)(x0)(xx0)n+Rn(x)可以变形为: f ( x ) = a 0 + a 1 ( x − x 0 ) + a 2 ( x − x 0 ) 2 + a 3 ( x − x 0 ) 3 + R n ( x ) f(x) = a_0 + a_1(x-x_0) + a_2(x-x_0)^2 + a_3(x-x_0)^3 + R_n(x) f(x)=a0+a1(xx0)+a2(xx0)2+a3(xx0)3+Rn(x), 其中 a n = f ( n ) ( x 0 ) n ! a_n = \frac{f^{(n)}(x_0)}{n!} an=n!f(n)(x0) 根据上式有: f ′ ( x ) = a 1 + 2 a 2 ( x − x 0 ) + 3 a 3 ( x − x 0 ) 2 + . . . f'(x) = a_1 + 2a_2(x-x_0) + 3a_3(x-x_0)^2 + ... f(x)=a1+2a2(xx0)+3a3(xx0)2+... f ′ ′ ( x ) = 2 a 2 + 6 a 3 ( x − x 0 ) + . . . f''(x) = 2a_2 + 6a_3(x-x_0) + ... f(x)=2a2+6a3(xx0)+... f ′ ′ ′ ( x ) = 6 a 3 + . . . f'''(x) = 6a_3 + ... f(x)=6a3+...…将 x 0 x_0 x0带入之后,直接约去了x, 有: f ′ ( x 0 ) = a 1 ⇒ a 1 = f ′ ( x 0 ) 1 ! f'(x_0) = a_1 \Rightarrow a_1 = \frac{f'(x_0)}{1!} f(x0)=a1a1=1!f(x0) f ′ ′ ( x 0 ) = 2 a 2 ⇒ a 2 = f ′ ′ ( x 0 ) 2 ! f''(x_0) = 2a_2 \Rightarrow a_2 = \frac{f''(x_0)}{2!} f(x0)=2a2a2=2!f(x0) f ′ ′ ′ ( x 0 ) = 6 a 3 ⇒ a 3 = f ′ ′ ′ ( x 0 ) 3 ! f'''(x_0) = 6a_3 \Rightarrow a_3 = \frac{f'''(x_0)}{3!} f(x0)=6a3a3=3!f(x0)

    泰勒公式的应用

    1 ) 麦克劳林公式

    e x = 1 + x + 1 2 ! x 2 + . . . + 1 n ! x n + o ( x n ) e^x = 1 + x + \frac{1}{2!}x^2 + ... + \frac{1}{n!}x^n + o(x^n) ex=1+x+2!1x2+...+n!1xn+o(xn) 这里 e x e^x ex的n阶导数都是它本身, 无惧降维打击其次, e x = ∑ n = 0 ∞ x n n !    x ∈ R e^x = \sum_{n=0}^\infty \frac{x^n}{n!} \ \ x \in R ex=n=0n!xn  xR进行泰勒展开就有上式 s i n x = x − 1 3 ! x 3 + . . . + ( − 1 ) m − 1 ( 2 m − 1 ) ! x 2 m − 1 + o ( x 2 m − 1 ) sin x = x - \frac{1}{3!}x^3 + ... + \frac{(-1)^{m-1}}{(2m - 1)!} x^{2m -1} + o(x^{2m -1}) sinx=x3!1x3+...+(2m1)!(1)m1x2m1+o(x2m1) f ( x ) = s i n x , x 0 = 0 f(x) = sin x, x_0 = 0 f(x)=sinx,x0=0 s i n ′ x = c o s x 、 s i n ′ ′ x = − s i n x 、 s i n ′ ′ ′ x = − c o s x 、 s i n ( 4 ) x = s i n x 、 s i n ( 5 ) x = c o s x 、 s i n ( 6 ) x = − s i n x 、 . . . sin'x=cosx、sin''x=-sinx、sin'''x=-cosx、sin^{(4)}x = sinx、sin^{(5)}x = cosx、sin^{(6)}x = -sin x、... sinx=cosxsinx=sinxsinx=cosxsin(4)x=sinxsin(5)x=cosxsin(6)x=sinx... s i n x = 0 + 1 1 ! x + 0 2 ! + − 1 3 ! x 3 + 0 4 ! + 1 5 ! x 5 + 0 6 ! + − 1 7 ! x 7 + . . . sinx=0+\frac{1}{1!}x + \frac{0}{2!} + \frac{-1}{3!}x^3 + \frac{0}{4!} + \frac{1}{5!}x^5 + \frac{0}{6!} + \frac{-1}{7!}x^7 + ... sinx=0+1!1x+2!0+3!1x3+4!0+5!1x5+6!0+7!1x7+...由此推出上式另外:可以将它的n阶导数看成这样: f ( n ) ( x ) = s i n ( x + n π 2 ) f^{(n)}(x) = sin (x+\frac{n\pi}{2}) f(n)(x)=sin(x+2nπ) c o s x = 1 − 1 2 ! x 2 + 1 4 ! x 4 − . . . + ( − 1 ) m ( 2 m ) ! x 2 m + o ( x 2 m ) cos x = 1 - \frac{1}{2!}x^2 + \frac{1}{4!}x^4 - ... + \frac{(-1)^m}{(2m)!}x^{2m} + o(x^{2m}) cosx=12!1x2+4!1x4...+(2m)!(1)mx2m+o(x2m) 同理 s i n x sin x sinx l n ( 1 + x ) = x − 1 2 x 2 + 1 3 x 3 − . . . + ( − 1 ) n − 1 n x n + o ( x n ) ln(1+x) = x - \frac{1}{2}x^2 + \frac{1}{3}x^3 - ... + \frac{(-1)^{n-1}}{n} x^n + o(x^n) ln(1+x)=x21x2+31x3...+n(1)n1xn+o(xn) 这里是复合函数求导 f ( x ) = l n ( 1 + x ) f(x) = ln(1+x) f(x)=ln(1+x) f ′ ( x ) = 1 1 + x , f ′ ′ ( x ) , f ′ ′ ′ ( x ) , . . . . f'(x) = \frac{1}{1+x}, f''(x), f'''(x), .... f(x)=1+x1,f(x),f(x),....同理推出上式 1 1 − X = 1 + x + x 2 + . . . + x n + o ( x n ) \frac{1}{1 - X} = 1 + x + x^2 + ... + x^n + o(x^n) 1X1=1+x+x2+...+xn+o(xn) ( 1 + x ) m = 1 + m x + m ( m − 1 ) 2 ! x 2 + . . . + m ( m − 1 ) . . . ( m − n + 1 ) n ! x n + o ( x n ) (1+x)^m = 1 + mx + \frac{m(m-1)}{2!}x^2 + ... + \frac{m(m-1)...(m-n+1)}{n!}x^n + o(x^n) (1+x)m=1+mx+2!m(m1)x2+...+n!m(m1)...(mn+1)xn+o(xn)

    另外:关于 s i n x = x − 1 3 ! x 3 + . . . + ( − 1 ) m − 1 ( 2 m − 1 ) ! x 2 m − 1 + o ( x 2 m − 1 ) sin x = x - \frac{1}{3!}x^3 + ... + \frac{(-1)^{m-1}}{(2m - 1)!} x^{2m -1} + o(x^{2m -1}) sinx=x3!1x3+...+(2m1)!(1)m1x2m1+o(x2m1)的推导,参考下图,可见n越大,误差越小

    备注:图片托管于github,请确保网络的可访问性

    2 ) 计算自然常数e的近似值

    计算近似值 e = lim ⁡ x → ∞ ( 1 + 1 n ) n e = \lim_{x \to \infty} (1 + \frac{1}{n})^n e=limx(1+n1)n,并估计误差值分析 y = e x ⇒ y ′ = y = e x y = e^x \Rightarrow y' = y = e^x y=exy=y=ex e x ≈ ∑ k = 0 n e x 0 k ! ( x − x 0 ) k e^x \approx \sum_{k=0}^n \frac{e^{x_0}}{k!} (x - x_0)^k exk=0nk!ex0(xx0)k x 0 = 0 ⇒ x_0 = 0 \Rightarrow x0=0 e x ≈ 1 + x + x 2 2 ! + . . . + x n n ! e^x \approx 1 + x + \frac{x^2}{2!} + ... + \frac{x^n}{n!} ex1+x+2!x2+...+n!xn x = 1 ⇒ x = 1 \Rightarrow x=1 e ≈ 1 + 1 + 1 2 ! + 1 3 ! + . . . + 1 n ! e \approx 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + ... + \frac{1}{n!} e1+1+2!1+3!1+...+n!1 x = 10 ⇒ x = 10 \Rightarrow x=10 e ≈ 2.7182815 e \approx 2.7182815 e2.7182815余项(误差): δ = ∣ R 10 ∣ = 1 11 ! + 1 12 ! + . . . = 1 11 ! ( 1 + 1 12 + 1 12 ∗ 13 + . . . ) < 1 11 ! ( 1 + 1 12 + 1 1 2 2 + . . . ) = 12 11 ∗ 11 ! = 2.73 ∗ 1 0 − 8 \delta = |R_{10}| = \frac{1}{11!} + \frac{1}{12!} + ... = \frac{1}{11!}(1 + \frac{1}{12} + \frac{1}{12 * 13} + ...) < \frac{1}{11!} (1 + \frac{1}{12} + \frac{1}{12^2} + ...) = \frac{12}{11*11!} = 2.73 * 10^{-8} δ=R10=11!1+12!1+...=11!1(1+121+12131+...)<11!1(1+121+1221+...)=1111!12=2.73108 微乎其微了当n逐渐变大时,参考下图 备注:图片托管于github,请确保网络的可访问性
    Processed: 0.012, SQL: 9