Units - Maple Help

Improvements in Handling of Units in Maple 2024

Maple 2024 includes several improvements to the handling of units.

Faster computation with Matrices with Units

 • When working with matrices with entries with units, Maple can now perform operations much faster than before.  See the Performance Improvements in Maple 2024 help page for details.

The Statistics package

 • The Statistics package deals with many aspects of statistics. Its functionality is divided up into a few large parts. Nearly all commands mentioned on the Descriptive Statistics, Random Variables, and Distributions help pages will work with units.
 > with(Statistics):
 • 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)));
 ${\mathrm{rv1}}{≔}{\mathrm{_R}}$ (1)
 > rv2 := RandomVariable(Weibull(5*Unit(m), 2*Unit(m)));
 > rv2 := RandomVariable(Weibull(5*Unit(m), 2));
 ${\mathrm{rv2}}{≔}{\mathrm{_R0}}$ (2)
 • We can compute various statistical properties of these distributions as follows.
 > Mean(rv1);
 ${5}{}⟦{m}⟧$ (3)
 > Variance(rv2);
 $\left({25}{-}\frac{{25}{}{\mathrm{\pi }}}{{4}}\right){}⟦{{m}}^{{2}}⟧$ (4)
 > Skewness(rv1 - rv2);
 ${-}\frac{{61035156250}{}\sqrt{{\mathrm{\pi }}}{}\left({\mathrm{\pi }}{-}{3}\right)}{{\left({40368949}{-}{9765625}{}{\mathrm{\pi }}\right)}^{{3}}{{2}}}}$ (5)
 > evalf((5));
 ${-0.5078727141}$ (6)
 • 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)];
 ${\mathrm{sample}}{≔}\left[{0.0377}{}⟦{\mathrm{ft}}⟧{,}{0.578}{}⟦{\mathrm{ft}}⟧{,}{2.05}{}⟦{\mathrm{ft}}⟧{,}{3.60}{}⟦{\mathrm{ft}}⟧{,}{4.92}{}⟦{\mathrm{ft}}⟧{,}{5.45}{}⟦{\mathrm{ft}}⟧{,}{5.75}{}⟦{\mathrm{ft}}⟧{,}{6.21}{}⟦{\mathrm{ft}}⟧{,}{2.77}{}⟦{m}⟧{,}{3.41}{}⟦{m}⟧{,}{4.01}{}⟦{m}⟧{,}{4.54}{}⟦{m}⟧{,}{5.41}{}⟦{m}⟧{,}{5.54}{}⟦{m}⟧{,}{5.61}{}⟦{m}⟧{,}{6.18}{}⟦{m}⟧{,}{7.21}{}⟦{m}⟧{,}{9.34}{}⟦{m}⟧{,}{13.9}{}⟦{m}⟧{,}{14.9}{}⟦{m}⟧\right]$ (7)
 > Mean(sample);
 ${15.0157430049500}{}⟦{\mathrm{ft}}⟧$ (8)
 > Variance(sample);
 ${189.446615326348}{}⟦{{\mathrm{ft}}}^{{2}}⟧$ (9)
 > Skewness(sample);
 ${1.18031316013932}$ (10)
 • Cumulants of quantities with units are not well-defined. The Cumulant command checks for this and raises an error if appropriate.
 > Cumulant(rv1, 3);
 > distance := 3*Unit(m);
 ${\mathrm{distance}}{≔}{3}{}⟦{m}⟧$ (11)
 > Cumulant(rv2 / distance, 3);
 $\frac{{25}{}\sqrt{{25}}{}\sqrt{{\mathrm{\pi }}}}{{36}}{-}\frac{{125}{}\sqrt{{\mathrm{\pi }}}}{{18}}{+}\frac{{125}{}{{\mathrm{\pi }}}^{{3}}{{2}}}}{{108}}$ (12)
 > evalf((12));
 ${0.290470418}$ (13)
 > Cumulant(sample, 3);
 • 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));
 ${10.1286139500500}{}⟦{\mathrm{ft}}⟧$ (14)
 > AbsoluteDeviation(rv2, Mean(sample));
 ${1.878130286}{}⟦{m}⟧$ (15)
 • 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);
 $\left({125}{+}\frac{{40368949}{}\sqrt{{\mathrm{\pi }}}}{{625000}}{-}\frac{{5}{}\sqrt{{25}}{}\sqrt{{\mathrm{\pi }}}{}\left({5}{+}\frac{{5}{}\sqrt{{\mathrm{\pi }}}}{{2}}\right)}{{2}}\right){}⟦{{m}}^{{3}}⟧$ (16)
 > evalf((16));
 ${30.5302225}{}⟦{{m}}^{{3}}⟧$ (17)
 > Correlation(rv1 * rv2, rv1);
 $\frac{{1143}{}\sqrt{{25}}{}\sqrt{{\mathrm{\pi }}}}{{10}{}\sqrt{{40368949}{-}{9765625}{}{\mathrm{\pi }}}}$ (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)];
 ${\mathrm{sample2}}{≔}\left[{33.15}{}⟦{N}⟧{,}{32.92}{}⟦{N}⟧{,}{55.91}{}⟦{N}⟧{,}{34.00}{}⟦{N}⟧{,}{16.81}{}⟦{N}⟧{,}{38.74}{}⟦{N}⟧{,}{20.80}{}⟦{N}⟧{,}{-}{16.14}{}⟦{N}⟧{,}{19.70}{}⟦{N}⟧{,}{48.93}{}⟦{N}⟧{,}{1.10}{}⟦{N}⟧{,}{42.43}{}⟦{N}⟧{,}{1.53}{}⟦{N}⟧{,}{-}{26.54}{}⟦{N}⟧{,}{15.59}{}⟦{N}⟧{,}{8.764}{}⟦{N}⟧{,}{-}{27.57}{}⟦{N}⟧{,}{-}{13.60}{}⟦{N}⟧{,}{-}{40.35}{}⟦{N}⟧{,}{-}{64.21}{}⟦{N}⟧\right]$ (19)
 > Covariance(sample, sample2);
 ${-}{109.525825439543}{}⟦{J}⟧$ (20)
 > Correlation(sample, sample2);
 ${-0.813010115206344}$ (21)

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.
 > restart;
 > with(Units):
 > UseSystem(IPS);
 > velocity := 1*Unit(inch/second);
 ${\mathrm{velocity}}{≔}⟦\frac{{\mathrm{in}}}{{s}}⟧$ (22)
 > mass := 5*Unit(pound);
 ${\mathrm{mass}}{≔}{5}{}⟦{\mathrm{lb}}⟧$ (23)
 > velocity^2 * mass;
 $\frac{{2540}}{{196133}}{}⟦{\mathrm{lbf}}{}{\mathrm{in}}⟧$ (24)
 • Converting this quantity to the SI and FPS system can be done, for example, as follows.
 > convert((24), 'system', 'SI');
 $\frac{{731599133573}}{{500000000000000}}{}⟦{J}⟧$ (25)
 > convert((24), 'system', 'FPS');
 $\frac{{635}}{{588399}}{}⟦{\mathrm{lbf}}{}{\mathrm{ft}}⟧$ (26)
 • The IPS system is also available in the Units Formatting dialog.
 • Maple also supports more specialized systems of units.
 > convert((24), 'system', 'Atomic');
 ${3.356155884}{×}{{10}}^{{14}}{}⟦{\mathrm{E0}}⟧$ (27)
 > convert((24), 'system', 'ESU');
 $\frac{{731599133573}}{{50000000}}{}⟦{\mathrm{erg}}⟧$ (28)