Divide with expressions?
viktorstrate opened this issue · 5 comments
viktorstrate commented
Could it be possible to make expressions dividable with other expressions. Eg
new Expression(1).divide(new Expression('x'))
If I try this now I get
TypeError: Invalid Argument (x): Divisor must be of type Fraction or Integer.
And make variables remove them self, like this
var upper = new Expression('x').multiply(2)
var lower = new Expression('x').multiply(4)
var result = upper.divide(lower) // expected result: 1/2
Edit: replaced .add()
with .multiply()
, thanks @Benjadahl
pvskand commented
I guess no! As of now division of expressions with expressions is not implemented!
Benjadahl commented
Note: (2 + x)/(4 + x) != 1/2
It would be (2 * x)/(4 * x)
Unless I am terribly bad at math :P
viktorstrate commented
You're right my bad, I've updated the original post.
KhubaibQaiser commented
Facing same issue. Any update on this?
IsaMorphic commented
I have this implemented to a certain extent, although I'm not actively working on it. Check it out here: https://github.com/yodadude2003/algebra.js