JavaScript library for solving quartic equations.
$ npm install @skymaker/quartic
Pass an array of the 5 coefficients of equation to solve, from the x^4
term down to the constant term.
The results are returned as Math.js complex number objects, with re
and im
properties that hold the real and imaginary part of the complex root respectively.
var quartic = require('quartic');
//Solve 5x^4 + 4x^3+ 3x^2 + 2x + 1
var roots = quartic.solve(5,4,3,2,1);
console.log(roots);
$ git clone https://github.com/lavelle/quartic
$ cd quartic
$ npm install
$ npm test
Core code is from a web solver written by David Binner
Released with permission from the original author under the MIT license.