Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Divide with expressions? #76

Open
viktorstrate opened this issue Mar 20, 2017 · 5 comments
Open

Divide with expressions? #76

viktorstrate opened this issue Mar 20, 2017 · 5 comments

Comments

@viktorstrate
Copy link

viktorstrate commented Mar 20, 2017

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
Copy link
Contributor

pvskand commented Mar 20, 2017

I guess no! As of now division of expressions with expressions is not implemented!

@Benjadahl
Copy link
Contributor

Note: (2 + x)/(4 + x) != 1/2

It would be (2 * x)/(4 * x)

Unless I am terribly bad at math :P

@viktorstrate
Copy link
Author

viktorstrate commented Apr 8, 2017

You're right my bad, I've updated the original post.

@KhubaibQaiser
Copy link

Facing same issue. Any update on this?

@IsaMorphic
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants