Matlab 逐步搜索法求解方程根区间 - f(x) = x^3 - x - 1 = 0
syms x f = @(x) x^3 - x - 1; a = 0; b = 0.1; delta = 0.01; while f(a) * f(b) > 0 a = a + delta; b = b + delta; if b > 0.1 error('No root found within the range.'); end end fprintf('The root is within the range [%f, %f]. ', a, b);
原文地址: https://www.cveoy.top/t/topic/nanf 著作权归作者所有。请勿转载和采集!