Scientific Calculator
falcon/NRroot
By Falcon
Root of a function using Newton-Raphson method
Tagged:
var NRroot = function (f, x) {
dx = 1e-15;
eps = 1e-15;
err = 1;
while (err > eps) -> (
x0 = x;
x = x0 - f(x0)*dx / (f(x0+dx)-f(x0) );
err = abs(x-x0);
);
x
}
0 Comments
Sign in to leave a comment