Is it possible to set a default set of units for output?
I've just discovered the joys of units and Quantity
. Ideally, I'd like to be able to tell Mathematica to always convert to SI units. I'm aware I could UnitConvert
every entry, but that's not what I'm after: I want to set and forget. Is this possible, and if so, how?
Digging around the docs is making me think the answer is "No, it isn't", which is disappointing.
Edit:
This is not the same as setting the units to default in metric. My default is metric. However, Mathematica will keep things in pre-defined quantities if I use them. As an arbitrary example, consider below:
$Unitsystem
mass = 10 Quantity["SolarMass"]
inertia = 2/5 mass
The output of this is
Metric
Quantity[10, "SolarMass"]
Quantity[400, ("Meters")^2 "SolarMass"]
i.e. it does not convert from solar mass units, even though my unit system is metric. I could explicitly tell it to convert every line, but that's what I'm trying to avoid.
$Post = Replace[q_Quantity:>UnitConvert[q]]
$\endgroup$$Post =If[Head[#] === Quantity, UnitConvert[#], #]&
or$PrePrint = If[Head[#] === Quantity, UnitConvert[#], #]&
. $\endgroup$$UnitSystem = "Metric"
to your init.m file. $\endgroup$