nicolewhite / algebra.js

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

Formula support? #64

Closed guy-kdm closed 7 years ago

guy-kdm commented 8 years ago

Hi there! I was thinking about adding formula and formula simplification support, as in defining a multi variable expression or equation and having solveFor return an expression (if it is linear or quadratic in regards to the solved variable), also adding domains of definition to each solution expression. Does that make sense (and doesn't already exist somehow)?

nicolewhite commented 8 years ago

If I understand you correctly, I think that already exists? At least the part about solveFor returning an expression:

var e = new Expression('x').add('y');
var eq = new Equation(e, 3);
eq.toString();
"x + y = 3"
eq.solveFor('x').toString();
"-y + 3"