## Mathematical Expressions as Trees 3: Proper Expression Modelling

If you haven’t done so yet, read parts one and two first or watch the video that inspired these posts.
You can find a notebook with the state after this blog post here.
Last time there was a problem in the expression simplification left, which is apparent when looking at these two expressions:
str(Mul(Con(2), Mul(Con(3), Var('x'))).simplify()) # returns '2*3*x' str(Mul(Mul(Con(2), Con(3)), Var('x')).simplify()) # returns '6*x' They model the same expression, so both should return the second (simpler) string.
[Read More]