newton-raphson

JavaScript implementation of the Newton-Raphson method for approximating roots of a real-valued function

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
newton-raphson
0.0.38 years ago8 years agoMinified + gzip package size for newton-raphson in KB

Readme

newton-raphson

JavaScript implementation of the Newton-Raphson method for approximating roots of a real-valued function. See Wikipedia for details on the theory.

Usage

var findRoot = require('newton-raphson');

function f(x) {
  return x * x - 2;
}
function fprime(x) {
  return 2 * x;
}
var initialGuess = 1;

findRoot(f, fprime, 1);
// 1.4142135623730951