nicolewhite / algebra.js

Build, display, and solve algebraic equations.
http://algebra.js.org
MIT License
1.34k stars 111 forks source link

solveFor returns empty array #77

Closed LiranBri closed 7 years ago

LiranBri commented 7 years ago

Hello,

I'm trying to solve the following equation: ‌125/36 = -p^2 + 2p

however, I get empty array.

code to replicate:

let leftSide = new Expression(125).divide(36);
let rightSide = algebra.parse("-p^2 + 2p");
let equation = new Equation(leftSide, rightSide);
let solvedAnswers = equation.solveFor("p");

Am I missing something? Thank you

LiranBri commented 7 years ago

Answering to myself: the problem was that the answer is not a real number