The new Simple environment for units makes computations with units easier than ever. It allows you to work with expressions such as 5mm+x, where x is unassigned, as long as the dimensional analysis of the expression determines there is a valid quantity with units for the variable x.
Since the introduction of the Units package for Maple 7 (in 2001), there have been three ways to compute with unit expressions:
The default units environment, in which you explicitly invoke commands such as combine,units or convert,dimensions whenever you want to use unit functionality. This environment is suitable for expert users.
The Standard units environment, in which unit functionality is enabled for most basic operations. This environment requires that units are explicitly marked as such.
The Natural units environment, in which unit functionality is also enabled for most basic operations. This environment automatically interprets any variable name that corresponds to a unit name, as that unit.
Maple 2017 introduces a fourth way to compute with unit expressions: the Simple units environment. This differs from the Standard and Natural environments in two important ways, both of which make it easier to work with this environment in many cases:
The Standard and Natural environments require that whenever you use an unassigned variable (in the case of the Natural environment, an unassigned variable that is not the name of a unit), it represents a unitless quantity. This rule applies for verifying dimensional correctness - the process that makes sure you cannot add a distance to a velocity, for example. Concretely, you cannot just use a variable called distance to represent a distance to be determined later: instead, you might need to define distance by distance≔distance_km km, so that distance is now an assigned variable and distance_km is a unitless quantity representing the number of kilometers that distance is long. This restriction is relaxed for the Simple units environment: unassigned variables are not assumed to have any particular dimension during testing of dimensional correctness.
The Simple units environment disregards so-called unit annotations when verifying dimensional correctness. These annotations are a mechanism to indicate that the physical quantity described by the unit is of a particular type. For example, the unit mile_per_gallon of fuel economy is defined in Maple as milegallon⁡petroleum; this allows Maple to distinguish it from a unit of the dimension 1length2=1area (which would normally happen when simplifying an expression of the dimension length length3=lengthvolume). Another situation in which these annotations occur is in units of angle: a radian is defined as the angle that describes a circle sector in which the radius and the arc length are the same. This is defined in Maple as the unit mm⁡radius.
In many cases, however, users want to combine units while disregarding the unit annotations. This is particularly frequent whenever units of angle crop up. For that reason, the Simple units environment allows the addition of, for example, quantities with the dimension of angle to unitless quantities. The Standard and Natural environments do not.
Before Maple 2017, the default units environment always followed the same approach as the Standard and Natural units environments, with respect to these two issues. In Maple 2017, you can use the new UnitsUseMode command to switch between these two approaches in the default units environment.
Consider a situation where you know an object will undergo uniform acceleration, with an initial velocity of 2.4 meters per second. We can derive the generic formula for the position of the object at an arbitrary time as follows. We start with the general formula for velocity under uniform acceleration.
Now we substitute the given starting velocity.
Integrating this over time gives the requested answer.
Now let's additionally specify that the object starts at the origin, and the acceleration is gravity. We orient our axis of displacement so that the initial velocity was upward, so in the opposite direction to gravity.
If we want to know the position after 0.4 seconds, we can obtain it like this.
This example comes from the example worksheets for the various units environments; specifically, for the version for the Simple units environment. You can compare the default units example worksheet, the Standard units example worksheet, and the Natural units example worksheet.
The first example shows how you can use unassigned variables to represent quantities that are not unitless. The following example will show a case where it comes in handy that annotations are ignored when verifying dimensional correctness.
Consider tightening a nut using a wrench. You apply a constant torque of 30 newton meters over 6 full rotations. The friction increases the temperature of the nut by 5 degrees Celsius; the nut, which is sizeable, has a mass of 80 grams and is made of steel. Steel has a specific heat capacity of 452 joules per kilogram per Kelvin. How much energy did you expend, how much of it was converted to heat, and how much leaked away into the environment?
At the heart of the Simple units environment is the new command Units[TestDimensions]. This command verifies dimensional correctness of one or more expressions with units. By default, it returns true if there is a valid assignment of dimensions to all subexpressions of expr, and false otherwise. Validity is tested for all subexpressions occurring in expr.
This command can be useful to verify the dimensional validity of, for example, a set of equations involving some quantities with units.
If you know the dimension of only some of the quantities occurring in a set of equations, you can derive some things about the dimensions of the other symbols and of composite subexpressions. Sometimes you can fully derive the dimension of some quantities, other times there is not enough information.
If there are multiple valid assignments of dimensions to the symbols in an expression (in other words, if there is not enough information to fully determine the dimensions of some quantities), then Maple will make an arbitrary choice.
Instead of expressing the dimension by using a unit of the given expression, Maple can also return the name of the dimension (as it would be returned by convert/dimensions with the base option).
In this case, if there is ambiguity in the given set of expressions, Maple will determine an expression representing the fully general dimension for any subexpression. These expressions are mostly useful for programmer access.
By manipulating the result, we can see that the dimension of m⁢a is indeed what is claimed.
Download Help Document
What kind of issue would you like to report? (Optional)