Keeping numeric values not simplified when parsing expression


(José Manuel Nieto) #1

I’m using SymbolicExpression.Parse(“4+3+b”) and I’m getting “7+b” as a result. I would like the expression to retain the original composition (keeping the 4+3). Is it possible to do it? How?

Thanks!


(Christoph Rüegg) #2

This is not directly possible with the SymbolicExpression type, since its expressions trees are auto-simplified by definition (such that they are guaranteed to be in a normalized form which makes writing algebraic algorithms much more feasible).

We have another type called VisualExpression which is more about visual aspects than algebraic manipulations, and which does not apply such simplifications. Unfortunately, although formatting SymbolicExpression to infix strings is already transforming through such visual expressions, the parser has not been migrated, meaning that we don’t have a parser yet which produces a visual expression instead of a symbolic expression. So I expect it is not much use in you use case.

What would you like to do with such non-simplified expressions?