Substitutions for GenericSeries
and MathematicalExpression
#647
Labels
core
weldx core classes and functions
feature
new API features
low priority
low priority issues during ☕
I do not want to include this into the first version of the
GenericSeries
since it is already enough work, but I think we should definitely consider it in the future:Sometimes there are expressions that have repetitive terms. For example, consider the following I used in the
GenericSeries
tutorial:Here the term
x-t
is used twice. Not so bad you might think and it isn't as long as you do not start using units. Herex
is a spatial dimension with a length unit and t is time. Also, consider thattanh
requires an angular unit or no unit at all and suddenly you get a total mess. To get everything sorted out, you need to bloat this subterm toa * x + b * t
wherea
andb
are parameters that are just there to clear the units. And no, clearing the units from the variables in advance (before we evaluate) is also no option becausex
andt
might appear in other terms where the unit does not need to be cleared. The simple solution would be to have a substitution like this:Apart from some minor difficulties, this shouldn't be a big issue since it can be a simple text replacement in the beginning and get some more depth later (strings are not the only method to define a math expression or think of chained substitutions). This should probably be implemented as a feature of the
MathematicalExpression
The text was updated successfully, but these errors were encountered: