

Architectural Changes in Math.js v2 - MrQuincle
http://josdejong.com/blog/2015/08/08/architectural-changes-in-mathjs-v2/

======
pachydermic
Something I'd really like Math.js to do is to be able to simplify expressions.

Say I had "abx + c = y", I'd like to substitute values into a,b and c and get
something like "5x - 1 = y" back. But Math.js won't allow you to have these
kinds of "symbolic" variables in their expressions - trying to eval statements
such as the ones above will just return an error saying x and y are undefined.
Huge bummer in my view.

Anyone know about easy solutions to this problem? I may end up doing it
server-side before I render the equations I need, but I'd _really_ like to use
someone else's open source project rather than try to figure this stuff out
myself...

~~~
nicolewhite
You should check out this algebra.js project I've been working on for funsies.

    
    
      var exp = new Expression("a");
      exp = exp.multiply("b");
      exp = exp.multiply("x");
      exp = exp.add("c");
    
      console.log(exp.toString());
    
      exp = exp.evaluateAt({a:5, b:1, c:-1})
      console.log(exp.toString());
    
      var eq = new Equation(exp, new Expression("y"));
      console.log(eq.toString());
    
      var x = eq.solveFor("x");
      console.log("x = " + x.toString());
    

Yields:

    
    
      abx + c
      5x - 1
      5x - 1 = y
      x = 1/5y + 1/5
    

You can play with it here: [http://algebra.js.org/](http://algebra.js.org/)

~~~
josdejong
@nicolewhite algebra.js looks really interesting. I hadn't seen it before.
Maybe we can somehow join forces (I'm the author or math.js). If you're
interested just drop me a mail or open a discussion on github.

~~~
nicolewhite
Sure. I just looked at the expression tree you linked to above and it looks
like pretty similar functionality.

------
thomasfoster96
Sounds like a library like this would be a great place to use ES7 decorators -
except that function hoisting spoils the party :(

