Untitled
unknown
plain_text
a year ago
263 B
4
Indexable
f = @(x) x*x*x - 5*x + 1; x0 = 0; x1 = 1; tollarable_error = 0.00001; for i=1:100 x2 = x1 - ((x1-x0) *f(x1)) / (f(x1) - f(x0)); fprintf("Root %d = %f \n", i, x2); if abs(x2-x1) < tollarable_error break; endif x0 = x1; x1 = x2; endfor
Editor is loading...
Leave a Comment