I am looking forward to the next release. If the proposed substitution display is going to work, this perhaps implies a lot of changes under the hood.
I wonder whether the optimization (I'd call it evaluation) can be set separately for storage at definition time (as given, simplified) and for display (none, substitution, numerical, symbolical, substitution+numeric).
Storage/assignment:
- As given: stores the expression verbatim without even touching the units (operator # := #)
- simplified: stores the expression with context substituted and simplified symbolically (operator # <- #)
Evaluation:
- none: as stored without substitution or simplification (operator # ≡ #)
- substitution: with substitution of context but without further simplification (operator # = #)
- numerical: with substitution and numeric evaluation (eventually with symbolic evaluation (operator # = #)
- symbolical: with substitution and symbolic simplification (operator # => #, consistent with operator palette)
- substitution + numerical: ternary display operator with first the expression, then substitution, then numeric result (operator # = # = #, optional with two-lines of display and aligned = signs)
What is missing in the above list is an assignment operation with numerical evaluation (mainly for programming to avoid exploding symbolic expressions in loops). One could invent another operator or use the eval() function for just this.
The original request would be handled by defining the inputs with storage "as given" and displaying results with "substitution + numerical"
There is an interesting point on how to handle intermediate results. You may want them to be stored using the custom unit you specified for display. Otherwise, substitution display would use some arbitrary base unit which you can't control and which might be plain wrong (e.g. Hz for angular velocity or J for a torque).
F:=3*'kN
h:=2*'m
M:=F*h (stores F*h)
M.1:=F*h=3*'kN*2*'m=6*'kN*'m (stores 6*'kN*'m)
This raises the problem of how to control the decimal precision of intermediate results. Die-hard pencil-and-paper way would be to store the intermediate results with the precision used for display, but hat is probably something no one wants, because round-off errors would accumulate.
On the other hand full precision decimal fractions would look very ugly in substitution display. But for consistency, this is perhaps the best option.
Edited by user 07 July 2023 19:45:20(UTC)
| Reason: Not specified