-
See Also
- Quantity
- QuantityVariable
- QuantityVariablePhysicalQuantity
- QuantityVariableCanonicalUnit
- Interpreter
- Restricted
- Failure
- UnitConvert
-
- Interpreter Types
- Quantity
- StructuredQuantity
- PhysicalQuantity
- Age
- Percent
- PercentFraction
- HeuristicPercent
- CurrencyAmount
- CurrencyName
- Number
- ComputedAge
- ComputedPercent
- ComputedPercentFraction
- ComputedHeuristicPercent
- ComputedCurrencyAmount
- SemanticNumber
- ComputedNumber
- Related Guides
-
-
See Also
- Quantity
- QuantityVariable
- QuantityVariablePhysicalQuantity
- QuantityVariableCanonicalUnit
- Interpreter
- Restricted
- Failure
- UnitConvert
-
- Interpreter Types
- Quantity
- StructuredQuantity
- PhysicalQuantity
- Age
- Percent
- PercentFraction
- HeuristicPercent
- CurrencyAmount
- CurrencyName
- Number
- ComputedAge
- ComputedPercent
- ComputedPercentFraction
- ComputedHeuristicPercent
- ComputedCurrencyAmount
- SemanticNumber
- ComputedNumber
- Related Guides
-
See Also
"ComputedQuantity" (Interpreter Type)
Details
- "ComputedQuantity" can be used in Interpreter and related constructs, including deployed smart form fields.
- Use of "ComputedQuantity" requires connectivity to the Wolfram Cloud.
Allowed Forms
- Any natural-language quantity supported by "Quantity", or a computation yielding one.
Restriction Specifications
-
Restricted["ComputedQuantity",{{choices1,…}}] one among choices Restricted["ComputedQuantity",unit] convert to unit Restricted["ComputedQuantity",quantityvariable] restrict to units compatible with the physical quantity of quantityvariable Restricted["ComputedQuantity",unit,max] a quantity below Quantity[max,unit] Restricted["ComputedQuantity",unit,{min,max}] a quantity between Quantity[min,unit] and Quantity[max,unit] Restricted["ComputedQuantity",unit,{min,max,s}] a quantity between Quantity[min,unit] and Quantity[max,unit] with step s Restricted["ComputedQuantity",quantityvariable,max] a quantity below Quantity[max,unit], with unit the canonical unit of quantityvariable - The bounds min and max and step s can also be expressed as quantities.
Interpretation
- "ComputedQuantity" yields a Quantity.
Examples
Basic Examples (5)
Interpret quantities involving computations:
Interpreter["ComputedQuantity"]["2m + 15 cm"]Interpreter["ComputedQuantity"]["(Sqrt(2)+3Pi) Celsius to F "]Computations with data are allowed:
Interpreter["ComputedQuantity"]["height of Mt Everest"]Interpreter["ComputedQuantity"]["age of The Golden Gate"]Interpreter["ComputedQuantity"]["how old would JFK be today?"]Interpreter["ComputedQuantity"][ "days to Christmas"]Restrict and convert to a unit:
Interpreter[Restricted["ComputedQuantity", "Grams"]]["weight of the earth"]Restrict to a given physical quantity:
Interpreter[Restricted["ComputedQuantity", QuantityVariable["Time"]]][{"20 km", "runtime of the longest movie"}]Accept unitless inputs in the presence of an appropriate restriction:
Interpreter[Restricted["ComputedQuantity", QuantityVariable["Money"]]]["8^3"]Interpreter[Restricted["ComputedQuantity", "Microseconds"]]["1 billion"]Attach the unit to the interpreted number:
Interpreter[Restricted["ComputedQuantity", "Hours"]]["2+8+4.5+6+10"]Restrict with a bound and convert to a given unit:
Interpreter[Restricted["ComputedQuantity", "Gallons", Quantity[2, "Liters"]]]["half a pint"]Interpreter[Restricted["ComputedQuantity", "Kilometers", {1, 1000}]]["distance from Rome to Milan"]See Also
Quantity QuantityVariable QuantityVariablePhysicalQuantity QuantityVariableCanonicalUnit Interpreter Restricted Failure UnitConvert
Interpreter Types: Quantity StructuredQuantity PhysicalQuantity Age Percent PercentFraction HeuristicPercent CurrencyAmount CurrencyName Number ComputedAge ComputedPercent ComputedPercentFraction ComputedHeuristicPercent ComputedCurrencyAmount SemanticNumber ComputedNumber
Related Guides
History
Introduced in 2014 (10.0)