Solve a Cubic Equation

node v0.12.18
version: 1.0.1
endpointsharetweet
var algebra = require("algebra.js"); var Expression = algebra.Expression; var Equation = algebra.Equation;
var exp = new Expression("x"); exp = exp.add(2); exp.toString();
exp = exp.pow(3); exp.toString();
var eq = new Equation(exp, 4); eq.toString();
var x = eq.solveFor("x"); "x = " + x.toString();
:)
Loading…

2 comments

  • posted 6 years ago by balalaxd
    sweet
  • posted 6 years ago by balalaxd
    But my result is "x = -0.4125989480318004"

sign in to comment