## 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]

## Mathematical Expressions as Trees 2: Derivations and Expression Simplification

If you haven’t done so yet, read part one first or watch the video that inspired these posts. You can find a notebook with the state after this blog post here. More Functionality So far we mainly recreated what was already shown in the YouTube video and to be honest, this is not very useful yet. So I extended this base structure by a few parts. Partial Derivatives The obvious extension, which was triggered by the video, is the addition of partial derivatives. [Read More]

## Mathematical Expressions as Trees 1: Modeling, Evaluation and Printing

I recently watched a computerphile video, where Prof. Thorsten Altenkirch talks about the data structures of trees and using them to model mathematical expressions. At the end, it is briefly mentioned, that this can also be used to perform derivations on the expressions, which inspired me to try that out myself. So I opend up a jupyter notebook and started with an implementation analogous to what was done in the video, but a bit extended. [Read More]