PRINTVAL: Difference between revisions
(Created page with "{{Keyword | <code>{ options } PRINTVAL expression</code> | 2= Try to find a value for the expression from any equations defined previously in the document. A value is...") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
The expression will contain rational numbers, not floats, unless a conversion to a floating point number is required to obtain a quantity. This might be the case e.g. if the expression contains square roots of rational numbers. If you want to force a conversion to floats, use <code>[[QUANTITY]]</code> instead. | The expression will contain rational numbers, not floats, unless a conversion to a floating point number is required to obtain a quantity. This might be the case e.g. if the expression contains square roots of rational numbers. If you want to force a conversion to floats, use <code>[[QUANTITY]]</code> instead. | ||
Print the result as an equation with the expression on the left hand side and the value on the right hand side. This keyword is more or less a shortcut for <code>[[TEXT]] expression =</code> followed by <code>[[EXDEF]] [[VAL]](expression)</code>. | Print the result as an equation with the expression on the left hand side and the value on the right hand side. This keyword is more or less a shortcut for <code>[[TEXT]] [[expression]] =</code> followed by <code>[[EXDEF]] [[VAL]]([[expression]])</code>. | ||
| | | | ||
3= | 3= | ||
Line 22: | Line 22: | ||
| | | | ||
4= | 4= | ||
[[PRINTVALWITH]] | [[PRINTVALWITH]] [[PRINTAVAL]] [[PRINTAVALWITH]] | ||
| | |||
5=2.2.2 | |||
}} | }} | ||
[[Category:Evaluation]] | [[Category:Evaluation]] |
Latest revision as of 19:22, 17 October 2018
Syntax
{ options } PRINTVAL expression
Implemented in iMath since version 2.2.2.
Explanation
Try to find a value for the expression from any equations defined previously in the document. A value is expected to be a quantity, that is a number with optional units. If the expression cannot be reduced to a quantity, it will be reduced to numerical values as far as possible.
The expression will contain rational numbers, not floats, unless a conversion to a floating point number is required to obtain a quantity. This might be the case e.g. if the expression contains square roots of rational numbers. If you want to force a conversion to floats, use QUANTITY
instead.
Print the result as an equation with the expression on the left hand side and the value on the right hand side. This keyword is more or less a shortcut for TEXT expression =
followed by EXDEF VAL(expression)
.
Example
EQDEF a = 3 x
EQDEF b = 2 x
EQDEF x = 7 %metre
PRINTVAL a+b
This will output a+b = 35 "m"
.