google / mathsteps

Step by step math solutions for everyone
https://socratic.org
Apache License 2.0
2.12k stars 275 forks source link

Purpose of lib/equation/Equation.js #136

Closed tkosan closed 7 years ago

tkosan commented 7 years ago

I am working on cleaning up the code in the demo discussed in #124, and I realized that not having a uniform data structure to return steps in requires separate code to handle the different cases. For example, the steps returned from solveEquation use lib/equation/Equation.js objects to hold expressions, but the steps return from simplifyExpression use math.expression.node.OperatorNode objects to hold expressions. After studying lib/equation/Equation.js I am not sure what abilities it provides beyond those provided by OperatorNode. Is there a reason for not treating equations more abstractly as expressions?

evykassirer commented 7 years ago

yeah you're totally right, it's super hacky

it's because mathjs doesn't have an equation node (which I was sad to find out while building this)

once we switch to math-parser we can clean up equation code to use the same kind of node as everywhere else

sound good?

tkosan commented 7 years ago

Yes, cleaning up the equation code after the switch to math-parser has been made sounds good. I will go ahead and submit a pull request for the demo I wrote and include a comment that indicates the mathsteps API will be changing in the near future.