Is Math.js capable of evaluating expressions in a topological order ?

172 Views Asked by At
math.eval(["c = b" , "a = b + c"] , {"a" : 1, "b" : 2})
[2, 4]

Switching the order of the expressions,

math.eval(["a = b + c" , "c = b"] , {"a" : 1, "b" : 2})
Error: Undefined symbol c

Setting initial value for c to NaN

math.eval(["a = b + c" , "c = b"] , {"a" : 1, "b" : 2, c: NaN})
[NaN, 2]

Is math.js capable of evaluating expressions in a topological order ?

1

There are 1 best solutions below

1
Jos de Jong On BEST ANSWER

No, math.js just evaluates the expressions sequentially.

Support for symbolic computations would be really nice though... See these related discussions on github.