I have the following expression:
x Quantity[y, ("Milliwatts"*"Seconds"^2)/"Joules"]
If I try to convert this to the SI unit, I would expect to get
Quantity[(x y)/1000, "Seconds"]
but it in fact returns unevaluated:
UnitConvert[x Quantity[y, ("Milliwatts"*"Seconds"^2)/"Joules"]]
From what I can tell,
UnitConvert only works with
Quantity expressions, and Mathematica is reluctant to treat
x as dimensionless and multiply it inside the
Quantity as part of the Quantity's value.
However, the following works no better:
UnitConvert[Quantity[x, "DimensionlessUnit"] Quantity[y, ("Milliwatts"*"Seconds"^2)/"Joules"]]
I could do a replacement rule like this:
Quantity[x_, "DimensionlessUnit"] Quantity[y_, z_] :> Quantity[x y, z]
which appears to do the job, but I don't see why it's necessary. It also seems like a rather crude solution.
I should mention that this is Mathematica 9.0.1, and I understand that Units have been somewhat overhauled in Mathematica 10, but that's not really an option for me at the moment.
Is it possible to force Quantity to include prefactors and assume they are numeric quantities?