where the same inner is used at each stage, if you go to simplify it, it will break this connection, and you will end up with:
expression = exp(cos(x1) - 3.2) + cos(x1) - 3.2
however, there is a way to get around this.
Whenever there is a shared node, it should be split into a system of equations. Then, each individual equation can be treated normally with simplification. At the end, the system of equations can be sewn together with the same structure as before, preserving shared variables.
Right now the simplification routines will break any shared subexpressions. This means if you have an expression:
where the same
inner
is used at each stage, if you go to simplify it, it will break this connection, and you will end up with:however, there is a way to get around this.
Whenever there is a shared node, it should be split into a system of equations. Then, each individual equation can be treated normally with simplification. At the end, the system of equations can be sewn together with the same structure as before, preserving shared variables.
@AlCap23 in case of interest