3
$\begingroup$

Today I came across the following behavior:

Quantity[x, "Minutes"/"Minutes"]^-1
(* Quantity[1/x, (1/#1 &)[("Minutes")/("Minutes")]] *)

It seems that Mathematica inverts both the unit and magnitude, but since Quantity has HoldRest, the unit does not evaluate further. This only seems to occur when taking a power of a dimensionless Quantity where at least one of the units cancels:

Quantity[a, "Meters" "Seconds"/"Minutes"/"Meters"]^2

exhibits this behavior, but

Quantity[a, "Meters" "Seconds"/"Minutes"/"Inches"]^2

and

Quantity[a, "Meters" "Seconds"/"Minutes"]^2

do not.

I feel like Mathematica should be able to handle this situation correctly. Should I report this?

(This is not actually a problem for me. I discovered this by accident when evaluating "100 km / 1200 m/min" as natural language input: Mathematica interprets "m/min" as "Minutes"/"Minute").

(Mathematica 10.0.1.0, Windows 8.1 64-bit)

$\endgroup$
  • $\begingroup$ In 10.1 Quantity[a, "Meters" "Seconds"/"Minutes"/"Meters"]^2 == Quantity[a^2/3600, "PureUnities"]. A UnitSimplify on the result of the second gives Quantity[(62500*a^2)/145161, "PureUnities"]. The last ends up as Quantity[a^2/3600, "Meters"^2]. I seems that it is fixed in 10.1 but that shouldn't stop you reporting for 10.0.1. $\endgroup$ – Edmund Apr 22 '15 at 1:52
  • $\begingroup$ @Edmund If they fixed it in a later release wouldn't reporting it be redundant? Unless they use a time machine to go back and fix it before my school decided not to update to 10.2 =) $\endgroup$ – 2012rcampion Apr 22 '15 at 2:00
  • $\begingroup$ Do they cease all support on later versions when they come out with a new one? Actually, that seems it could be the case now that I think about it. Its one method of getting you to upgrade. =) $\endgroup$ – Edmund Apr 22 '15 at 2:07
  • $\begingroup$ @Edmund I guess what I'm saying is if they fix any bugs in 10.0.1, they'd release an update; which they already did, 10.1.0. They won't re-release 10.0.1. $\endgroup$ – 2012rcampion Apr 22 '15 at 2:09
  • 1
    $\begingroup$ I am not sure whether this is (was) a bug or not. Yes, the units formally cancel, but when one encounters quantities like this (such as sheet resistance, ohm-metres per metre), it doesn't always make logical or physical sense to do so because the quantities cancelling are not related. $\endgroup$ – Oleksandr R. May 1 '15 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.