计算方法练习1

clc,clear,close all;
syms x n;
%IntI1=int(power(x,n)/(x+5),x,0,1);
%IntI2=int(power(x,n-1)/(x+5),x,0,1);
I0=int(power(x,0)/(x+5),x,0,1);
m=log(1.2);
if(I0==m)
    disp('true');
else 
    disp('false');
end
        
clc,clear,close all;
syms x;
x0=0.5
for i=1:100
    
    fx=x(i-1)*exp(x(i-1))-1;
    x(i)=x(i-1)-fx./(diff(fx,1));
    
end
disp(x(100))
clear
x0=0.5;
x1=x0-(x0*exp(x0)-1)/(exp(x0)+x0*exp(x0));
while(abs(x1-x0)>0.000001)
    x0=x1;4
    x1=x0-(x0*exp(x0)-1)/(exp(x0)+x0*exp(x0));
    if(abs(x1-x0)>0.000001)
        disp(x1);
        break;
    end
end
clear;
x0=1.5;
x1=1.4;
for i=1:10
    x2=x1-(power(x1,3)-x1-1)*(x1-x0)/((power(x1,3)-x1-1)-(power(x0,3)-x0-1))
    x0=x1;
    x1=x2;
    x(i)=x2
end
原创文章 84 获赞 34 访问量 6万+

猜你喜欢

转载自blog.csdn.net/qq_42194332/article/details/90522773