All pastes #330415 Raw Edit

Untitled

public text v1 · immutable
#330415 ·published 2007-01-27 21:52 UTC
rendered paste body
function newtons_method(f) = 

x_0  = 0;
x_current = 0;
x_new = 0;

while(abs(x_new - x_current) > 0.005) 
    x_new = x_current - f(x_current)/diff(f(x_current))
    x_current = x_new;
end

x_new;