VAL: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
<code>VAL ( [[expression]] )</code> | <code>VAL ( [[expression]] )</code> | ||
| | | | ||
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 | 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 <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 in this case, use <code>[[QUANTITY]]</code> instead. | ||
If the expression cannot be evaluated to a quantity (e.g. some symbolic elements remain), then iMath will retain mathematical precision. For example, square roots will not be evaluated to floating point numbers. If you want this, use [[SIMPLIFY]] with the <code>eval</code> simplification. | |||
| | | | ||
3= | 3= | ||
Line 19: | Line 21: | ||
| | | | ||
4= | 4= | ||
[[QUANTITY]] [[QUANTITYWITH]] [[NUMVAL]] [[NUMVALWITH]] [[VALWITH]] [[UNIT]] [[UNITWITH]] | [[QUANTITY]] [[QUANTITYWITH]] [[NUMVAL]] [[NUMVALWITH]] [[VALWITH]] [[AVAL]] [[AVALWITH]] [[UNIT]] [[UNITWITH]] | ||
}} | }} | ||
[[Category:Evaluation]] | [[Category:Evaluation]] |
Latest revision as of 05:38, 24 July 2022
Syntax
VAL ( expression )
Implemented in iMath since version 2.2.0 or earlier.
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 in this case, use QUANTITY
instead.
If the expression cannot be evaluated to a quantity (e.g. some symbolic elements remain), then iMath will retain mathematical precision. For example, square roots will not be evaluated to floating point numbers. If you want this, use SIMPLIFY with the eval
simplification.
Example
EQDEF a = 3 x
EQDEF b = 2 x
EQDEF x = 7 %metre
EXDEF VAL(a + b)
This will output 35 "m".
See also
QUANTITY QUANTITYWITH NUMVAL NUMVALWITH VALWITH AVAL AVALWITH UNIT UNITWITH