4
$\begingroup$

Is there a way to have a more common output format on MixedUnit?

Quantity[317.2,MixedUnit[{"Minutes"/"Kilometers", "Seconds"/"Kilometers"}]]

gives

enter image description here

I would love to have some unit like $$\frac{317\,\text{min } 12\, \text{s}}{km}$$

Quantity[317.2, MixedUnit[{"Minutes", "Seconds"}]/"Kilometers"]

gives an error

enter image description here

$\endgroup$
4
  • $\begingroup$ With v13.2 on my Mac your first example evaluates to {Quantity[MixedMagnitude[{317, 0}], MixedUnit[{("Minutes")/("Kilometers"), ("Seconds")/("Kilometers")}]], Quantity[MixedMagnitude[{12., 0}], MixedUnit[{("Minutes")/("Kilometers"), ("Seconds")/("Kilometers")}]]} to get your result I need Quantity[MixedMagnitude[{IntegerPart[#], 60*FractionalPart[#]} &[317.2]], MixedUnit[{"Minutes"/"Kilometers", "Seconds"/"Kilometers"}]] $\endgroup$
    – Bob Hanlon
    Commented Jan 5, 2023 at 19:57
  • $\begingroup$ @BobHanlon I used v13.0 on Windows, but seems strange if the output differs so much between some minor releases. $\endgroup$
    – Phab
    Commented Jan 9, 2023 at 10:25
  • $\begingroup$ UnitConvert[Quantity[317.2, "Seconds"/"Kilometers"], MixedUnit[{"Minutes", "Seconds"}/"Kilometers"]] --> 5 min/km 17.2 s/km $\endgroup$
    – anon
    Commented Apr 18, 2023 at 22:39
  • $\begingroup$ Try 2: UnitConvert[Quantity[317.2, "Minutes"/"Kilometers"]*Quantity["Kilometers"], MixedUnit[{"Minutes", "Seconds"}]]/"km" ==> $\frac{317\, \text{min}\ 12.\text{s}}{\text{km}}$ $\endgroup$
    – anon
    Commented Apr 18, 2023 at 22:46

0

Your Answer

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

Browse other questions tagged or ask your own question.