How can I get Mathematica to properly simplify physical quantities with dimensions to decimal power, such as $1 \frac{1}{\text{s}^{0.7}}\text{dynes}\text{/(}\text{cm}^2\text{Pa})$ that should simplify to just $\frac{1}{10} \frac{1}{\text{s}^{0.7}}$ ?

Quantity[1, "Dynes"/("Centimeters"^2*"Pascals"*"Seconds"^(7/10))] // UnitConvert

(* Quantity[1/10, 1/("Seconds")^(7/10)] *)

but not

Quantity[1, "Dynes"/("Centimeters"^2*"Pascals"*"Seconds"^(0.7))] // UnitConvert

(* Quantity[1, ("Dynes")/(("Centimeters")^2 "Pascals" ("Seconds")^0.7)] *)

I also noticed that taking to the 0.5 power works:

Quantity[1, "Dynes"/("Centimeters"^2*"Pascals"*"Seconds"^(0.5))] // UnitConvert

(* Quantity[0.1, 1/("Seconds")^0.5] *)

The workaround with replacing the decimal number with a fraction works, but there should be a better way. I also looked for a way to specify that the number $0.7$ should be considered an exact number, but no luck.


1 Answer 1


As Guess ... points out

Quantity[1, "Dynes"/("Centimeters"^2*"Pascals"*"Seconds"^(0.7))] // 
   Rationalize // UnitConvert
Quantity[1/10, 1/"Seconds"^(7/10)]

does the job.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.