Improvements in Handling of Units in Maple 2024
Maple 2024 includes several improvements to the handling of units.
|
Faster computation with Matrices with Units
|
|
|
|
The Statistics package
|
|
•
|
Using a distribution will verify dimensional consistency of the units involved, and raise an error if the units are inconsistent, either because a particular parameter cannot have a (nontrivial) unit, or because multiple parameters have to agree with each other.
|
>
|
rv1 := RandomVariable(Normal(5*Unit(m), 2*Unit(s)));
|
>
|
rv1 := RandomVariable(Normal(5*Unit(m), 3*Unit(ft)));
|
>
|
rv2 := RandomVariable(Weibull(5*Unit(m), 2*Unit(m)));
|
>
|
rv2 := RandomVariable(Weibull(5*Unit(m), 2));
|
•
|
We can compute various statistical properties of these distributions as follows.
|
| (5) |
•
|
The same commands are used to compute these properties of a data sample.
|
>
|
sample := [.0377*Unit(ft), .578*Unit(ft), 2.05*Unit(ft), 3.60*Unit(ft), 4.92*Unit(ft), 5.45*Unit(ft), 5.75*Unit(ft), 6.21*Unit(ft), 2.77*Unit(m), 3.41*Unit(m), 4.01*Unit(m), 4.54*Unit(m), 5.41*Unit(m), 5.54*Unit(m), 5.61*Unit(m), 6.18*Unit(m), 7.21*Unit(m), 9.34*Unit(m), 13.9*Unit(m), 14.9*Unit(m)];
|
| (7) |
•
|
Cumulants of quantities with units are not well-defined. The Cumulant command checks for this and raises an error if appropriate.
|
>
|
Cumulant(rv2 / distance, 3);
|
| (12) |
Error, (in Statistics:-Cumulant) unexpected input: expected Vector(20, [.1149096000e-1*Units:-Unit(m),.1761744000*Units:-Unit(m),.6248400000*Units:-Unit(m),1.097280000*Units:-Unit(m),1.499616000*Units:-Unit(m),1.661160000*Units:-Unit(m),1.752600000*Units:-Unit(m),1.892808000*Units:-Unit(m),2.77*Units:-Unit(m),3.41*Units:-Unit(m),4.01*Units:-Unit(m),4.54*Units:-Unit(m),5.41*Units:-Unit(m),5.54*Units:-Unit(m),5.61*Units:-Unit(m),6.18*Units:-Unit(m),7.21*Units:-Unit(m),9.34*Units:-Unit(m),13.9*Units:-Unit(m),14.9*Units:-Unit(m)]) to not have units
| |
•
|
The second argument of the AbsoluteDeviation command must have the same dimension as the first argument. If it doesn't, an error is raised.
|
>
|
AbsoluteDeviation(sample, 5*Unit(s));
|
>
|
AbsoluteDeviation(sample, 2*Unit(fathom));
|
>
|
AbsoluteDeviation(rv2, Mean(sample));
|
•
|
Covariance is defined for data samples with different dimensions. So is correlation. Note how the covariance has a unit, but the correlation doesn't.
|
>
|
Covariance(rv1 * rv2, rv1 + rv2);
|
| (16) |
>
|
Correlation(rv1 * rv2, rv1);
|
| (18) |
>
|
sample2 := [33.15 * Unit(N), 32.92 * Unit(N), 55.91 * Unit(N), 34.00 * Unit(N), 16.81 * Unit(N), 38.74 * Unit(N), 20.80 * Unit(N), -16.14 * Unit(N), 19.70 * Unit(N), 48.93 * Unit(N), 1.10 * Unit(N), 42.43 * Unit(N), 1.53 * Unit(N), -26.54 * Unit(N), 15.59 * Unit(N), 8.764 * Unit(N), -27.57 * Unit(N), -13.60 * Unit(N), -40.35 * Unit(N), -64.21 * Unit(N)];
|
| (19) |
>
|
Covariance(sample, sample2);
|
>
|
Correlation(sample, sample2);
|
|
|
The IPS system
|
|
•
|
Maple supports several so-called systems of units, which are combinations of units that are often used together. The default system is the SI system. Another system that is often used, especially in North America, is the FPS (foot-pound-second) system. For Maple 2024, we have added the IPS (inch-pound-second) system, demonstrated below.
|
Automatically loading the Units[Simple] subpackage
| |
>
|
velocity := 1*Unit(inch/second);
|
•
|
Converting this quantity to the SI and FPS system can be done, for example, as follows.
|
>
|
convert((24), 'system', 'SI');
|
| (25) |
>
|
convert((24), 'system', 'FPS');
|
•
|
Maple also supports more specialized systems of units.
|
>
|
convert((24), 'system', 'Atomic');
|
>
|
convert((24), 'system', 'ESU');
|
| (28) |
|
|