Open evykassirer opened 7 years ago
math-parser
will introduce a nice unified system for equations and simplifications. From what I gather there will be relation nodes (equal, less than, etc) which will model equations. There will also be all
and any
nodes to model a list of equations where all/any must hold. We will then be able to rewrite solveEquations
as a function that takes a all
node where all members are relations, etc! :)
There will also be all and any nodes to model a list of equations where all/any must hold.
I ended up making a System
node to model systems of equations. This avoids having to check two properties to determine if it's a system of equations (or inequalities).
I'd like to migrate mathsteps to use nodes from math-ast before introducing an equation node (aka Relation).
agreed, let's get it working with what we have, then slowly add functionality that math-ast can support :)
@kevinbarabash Are you sure that's the way to go? It seems that adding nodes which are just "verified" versions of other nodes generates extra complexity for little benefit. I don't see a problem with a system being represented as
{
type: 'All',
args: [
{ type: 'Relation', rel: 'eq', args: ['2x', '3'] },
{ type: 'Relation', rel: 'eq', args: ['x + 1', '0'] }
]
}
Is the following what you are proposing?
{
type: 'System',
args: [
{ type: 'Relation', rel: 'eq', args: ['2x', '3'] },
{ type: 'Relation', rel: 'eq', args: ['x + 1', '0'] }
]
}
In which case we would have both System and All nodes which do similar things?
@hmaurer I couldn't think of another use for an All
node beyond using it for system of equations. If it's only used for system of equations then calling it that makes the intention clear. Also, I found All
to a bit ambiguous. Does it mean that all of the equations must be satisfiable? If so, there are systems of equations where that isn't true.
@kevinbarabash Mmh I can't think of another use of All
within the scope of mathsteps either, but I can think of uses for Any
, e.g. when solving equations involving absolute values. I quite like the All
- Any
pair, but you make a good point.
And yes regarding "all equations must be satisfiable". Isn't that a good semantic for it? Solving a system of equations is then asking "can you find values for these variables such that those equations are all satisfied". It might fail, of course, but it still seems to make sense?
blocked on #128 (new parser) because once we have a new tree we can easily add equation nodes to it
--
once it's is done, we can make the equation code a lot nicer
see #126 for some more details, and we can plan this out better once the parser swap is done