Professional Documents
Culture Documents
GitHubscijs/newtonraphsonmethod:FindzerosofafunctionusingtheNewtonRaphsonmethod
Personal
Open source
Business
Explore
Pricing
Blog
Support
This repository
scijs / newtonraphsonmethod
Code
Issues 0
Watch
Pull requests 0
Projects 0
Pulse
Sign in
Search
Star
Sign up
Fork
Graphs
Branch: master
1 branch
0 releases
1 contributor
Find file
Clone or download
examples
Initial commit
5 months ago
images
Initial commit
5 months ago
test
Initial commit
5 months ago
.gitignore
Initial commit
5 months ago
.npmignore
Initial commit
5 months ago
.travis.yml
Initial commit
5 months ago
README.md
5 months ago
README.mdtex
5 months ago
index.js
5 months ago
package.json
5 months ago
README.md
newtonraphsonmethod
Find zeros of a function using Newton's Method
build passing
npmpackage 1.0.0
dependencies none
codestyle semistandard
Introduction
The NewtonRaphson method uses the tangent of a curve to iteratively approximate a zero of a function, f(x). This yields
the update:
Example
Consider the zero of (x+2)*(x1) at x=1:
varnr=require('newtonraphsonmethod');
functionf(x){return(x1)*(x+2);}
https://github.com/scijs/newtonraphsonmethod
1/3
11/7/2016
GitHubscijs/newtonraphsonmethod:FindzerosofafunctionusingtheNewtonRaphsonmethod
functionfp(x){return(x1)+(x+2);}
//Usingthederivative:
nr(f,fp,2)
//=>1.0000000000000000(6iterations)
//Usinganumericalderivative:
nr(f,2)
//=>1.0000000000000000(6iterations)
Installation
$npminstallnewtonraphsonmethod
API
require('newtonraphsonmethod')(f[,fp],x0[,options])
Given a realvalued function of one variable, iteratively improves and returns a guess of a zero.
Parameters:
f: The numerical function of one variable of which to compute the zero.
fp optional: The first derivative of f. If not provided, is computed numerically using a fourth order central difference
Returns: If convergence is achieved, returns an approximation of the zero. If the algorithm fails, returns false.
See Also
modifiednewtonraphson: A simple modification of NewtonRaphson that may exhibit improved convergence.
newtonraphson: A similar and lovely implementation that differs only? in requiring a first derivative.
License
2016 Scijs Authors. MIT License.
Authors
Ricky Reusser
https://github.com/scijs/newtonraphsonmethod
2/3
11/7/2016
2016 GitHub, Inc.
GitHubscijs/newtonraphsonmethod:FindzerosofafunctionusingtheNewtonRaphsonmethod
Terms
Privacy
Security
Status
https://github.com/scijs/newtonraphsonmethod
Help
Contact GitHub
API
Training
Shop
Blog
About
3/3