citardauq-roots
v0.0.5
Published
Numerically stable method for solving quadratic equations
Downloads
11
Readme
citardauq-roots
Numerically stable method for solving
quadratic equations
Note: 'citardauq' is 'quadratic', reversed
Install
$ npm install --save citardauq-roots
Usage
const quadraticRoots = require('citardauq-roots')
console.log(quadraticRoots(1, 0, -1))
// => [1, -1]
console.log(quadraticRoots(1, -5, 6))
// => [3, 2]
console.log(quadraticRoots(1, -2, 1))
// => [1]
console.log(quadraticRoots(-4, 1, 3))
// => [-0.75, 1]
console.log(quadraticRoots(0, 2, 3))
// => Error: a can not be 0
console.log(quadraticRoots(1, 0, 1))
// => Error: No real roots
License
MIT © Nicolás Quiroz