% salvare newton.m
% (http://www.dm.unibo.it/~achilles/calc/Programmi_CS4a/newton.m)
% in una delle cartelle dove Octave/MATLAB cerca i propri m-file
help newton
f = inline('x^2-a','x','a')
df = inline('2*x')
newton(f, df, 1, 1.e-6, 50, 2)
newton(f, df, 1, 1.e-6, 50, 3)
newton(f, df, 1, 1.e-6, 50, 16)
[alpha, residuo, iter] = newton(f, df, 1, 1.e-6, 50, 16)
[alpha, residuo, iter] = newton(f, df, 1, 1.e-12, 50, 16)
[alpha, residuo, iter] = newton(f, df, 3, 1.e-12, 50, 16)
format long
x = 1;
for k = 1:50 x = cos(x) end;
for k = 1:50 x = cos(x) end;
cos(x)-x
quit
# Octave 3.6.4, Mon Nov 11 13:01:16 2013 W. Europe Standard Time <unknown@achilles-TOSH>
