# Grouping units more sanely

Would it be possible to get Mathematica to group units more sanely. For example the calculation:

m = Quantity["Meters"];
D[
D[
Sin[p] (m),
Quantity[p, "Seconds"]] ,
Quantity[p, "Seconds"]] // Expand


This gives an visual output:

(-1 m/s^2) Sin[p]


however it would be more natural to show:

 -Sin[p](m/s^2)


I there a way to make this happen.

Notes:

• Expand is strictly not necessary in this case but can nice be in more complex cases.
-

These seem to work

m = Quantity[#, "Meters"] &;
D[D[Sin[p] // m, Quantity[p, "Seconds"]],
Quantity[p, "Seconds"]] // Expand


Or you transform by hand

nonQuantitiesAsMagnitudes[expr_] :=
expr /. x_ Quantity[y_, unit_] :> Quantity[x y, unit]

m = Quantity["Meters"];
D[
D[
Sin[p] (m),
Quantity[p, "Seconds"]] ,
Quantity[p, "Seconds"]] // Expand //nonQuantitiesAsMagnitudes

-
Yeah that's it. Still think that Mathematicas syntax for units is atrocious. My engineering students seem to come up with hives about this. But i think they can live with this. What does the &; do? –  joojaa Jan 13 '14 at 19:25