You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 23, 2019. It is now read-only.
var expr = new Expression("1");
expr = expr.subtract(-1);
console.log(expr.toString());
prints out 1+1 which is what I would expect looking at the code. It would be nice if subtraction could have a separate representation from adding the inverse. I'd like to use your library to create an interactive math widget. If users start with 1 and the action they take is to subtract -1 then I'd like them see 1-(-1) before giving them the option to rewrite it as 1+1. Not sure if this is something you'd want in algebra.js or not.
The text was updated successfully, but these errors were encountered:
Yeah, that's not really supported out of the box since everything is automatically reduced and combined. I can't think of a way to accomplish what you want that isn't really hacky, given the current functionality.
I wonder if it would make sense to add a simplify argument or something to all of the operations. Something like:
After thinking about it a bit, this is probably an unreasonable request because it would probably require significant changes to the current data structures. It's probably best to leave things be with the current auto-simplify behavior.
I don't think it's unreasonable. As I mentioned on Hacker News, I think interactive math widgets / tutorials is a great use case of the library and so I have no problem adding features to focus on that. I've created #4 for this. While this won't cover the specific case of displaying 1 - (-1) rather than 1 + 1, I think the changes to the code to allow unsimplified expressions will bring me closer to being able to do that.
prints out
1+1
which is what I would expect looking at the code. It would be nice if subtraction could have a separate representation from adding the inverse. I'd like to use your library to create an interactive math widget. If users start with1
and the action they take is to subtract-1
then I'd like them see1-(-1)
before giving them the option to rewrite it as1+1
. Not sure if this is something you'd want in algebra.js or not.The text was updated successfully, but these errors were encountered: