zoukankan      html  css  js  c++  java
  • 泰勒级数学习

     如此,用n+1次柯西定理,得:

     

    clear;clc;
    syms x
    ex=exp(x);
    f3=1+x+x^2/2+x^3/6;
    f6=1+x+x^2/2+x^3/6+x^4/24++x^5/120++x^6/720;
    f9=1+x+x^2/2+x^3/6+x^4/24++x^5/120++x^6/720+x^7/5040++x^8/40320++x^9/362880;
    %%%%%%%%对syms变量画图%%%%%%%
    left = 3;%区间左边
    size = 0.001;%步长 精度
    right= 7;%区间右边
    up = 50;
    down = 10;
    %axis([XMIN XMAX YMIN YMAX]) 设置二维图的x-y坐标范围
    t=[left:size:right-size];
    z=subs(ex,x,t);
    plot(t,z,'k');
    hold on

    t=[left:size:right-size];
    z=subs(f3,x,t);
    plot(t,z,'c');
    hold on

    t=[left:size:right-size];
    z=subs(f6,x,t);
    plot(t,z,'g');
    hold on

    t=[left:size:right-size];
    z=subs(f9,x,t);
    plot(t,z,'r');

    legend('exp(x)','3!','6!','9!');

    sin(x):--------------------------------------------

    syms x
    ex=sin(x);
    f1=x;
    f3=x-x^3/factorial(3);
    f5=x-x^3/factorial(3)+x^5/factorial(5);
    f7=x-x^3/factorial(3)+x^5/factorial(5)-x^7/factorial(7);
    f9=x-x^3/factorial(3)+x^5/factorial(5)-x^7/factorial(7)+x^9/factorial(9);

    cos(x):--------------------------------------------

     

  • 相关阅读:
    201920201学期20192407《网络空间安全专业导论》第一周学习总结
    JavaEEJSP详解
    JavaEEJSP指令
    JavaSE类与对象
    JavaSE基础知识
    JavaEEEL表达式
    JavaSE关键字
    JavaSE抽象类、内部类、接口
    JavaSE面向对象
    绪论
  • 原文地址:https://www.cnblogs.com/yangtuzi/p/7696642.html
Copyright © 2011-2022 走看看