x0 = 1.5; tol = 1e-5; max_iter = 1000; for i = 1:max_iter x1 =( 1 + x0)^(1/3); if abs(x1-x0) < tol break end x0 = x1; end fprintf('The root of f(x)=x^3-x^2-1=0 in [1.4,1.6] is approximately %.5f\n',x1); fprintf('The number of iterations is %d\n', i);

x0 = 15;tol = 1e-5;max_iter = 1000;for i = 1max_iter x1 = 1 + x0^13; if absx1-x0 tol break end x0 = x1;endfprintfThe root of fx=x^3-x^2-1=0 in 1416 is approximately 5fnx1;在上述代码的基础上

原文地址: https://www.cveoy.top/t/topic/b1om 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录