-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't represent this equation with mathjs: a + b = b + a #1364
Comments
Such equations are indeed not supported. It will be supported when we add support for a solver I think, see #38, though there is no one working on this yet. |
The error message offers a clue: "Invalid left hand side of assignment operator =". The single equals sign is assignment, not equality. I think you'll get what you want if you use double equals: const rootNode = math.parse("a + b == b + a") Then you should be able to manipulate the parse tree. |
@josdejong I've made a copy of mathjs code and I've modified it produce a 'binary operator' instead of the normal assigment node. That fits my need and it was easy to update the code to work the way I wanted. Thanks for your effort on this. @ChristopherChudzicki Thanks for the advice Chris, I'm actually making a maths visualizer be used by non-programers so I can't rely on them understanding the difference between = and ==. My maths visualizer simplifies a formula and shows the working out. Just a fun little project to help people understand how algebraic transformations work. Once it's finished I'll send you a link! |
👍 |
will close this issue now, feel free to reopen if needed. Sharing your visualizer would be cool of course :) |
Hi, Mathjs is awesome.
I'm having a problem with a particular equation that Mathjs doesn't seem to support.
I need to use the AST produced, here's some example code:
const rootNode = math.parse("a + b = b + a");
I get this error:
Is there a way to have Mathjs handle this type of equation? Or is it just not supported?
Thanks!
The text was updated successfully, but these errors were encountered: