# Why do expressions with physical units not get simplified?

I am trying to calculate precise values for certain expressions, see the image below.

The output testZPF of the function $$\Delta$$Fn should be a single output. I am trying to understand why Mathematica does not provide me with a single number in fully simplified units (here the dimension of the result is $$[m]$$), but instead prints the result in units of $$c$$ and $$\hbar$$.

Edit

For the dimensions, I tried to use UnitConvert, but get an error here. The error is very strange as the result should have indeed dimensions $$[m^{-1}]$$.

Edit 2

Here is the code:

\[Omega] =
2 Pi*Quantity[1,
"SpeedOfLight"]*(1/Quantity[735, "Nanometers"] -
1/Quantity[900, "Nanometers"])
Subscript[m, red] = Quantity[6, "AtomicMassUnit"]
Subscript[h, bar] = Quantity[1, "ReducedPlanckConstant"]

\[Del]Fn[\[Omega]_, m_] := Sqrt[Subscript[h, bar]/(\[Omega]*m)]
testZPF = \[Del]Fn[\[Omega], Subscript[m, red]]
UnitConvert[testZPF, "Meters"^(-1)]

• You have all integers and symbolic numbers (\[Pi]) in your equations. Mma uses infinite precision in these cases. You can move to machine precision by following your integers with a decimal; e.g. 1. instead of 1. This makes them machine precision reals and you'll get reals in the output. Commented Mar 20, 2022 at 13:36
• Ok, but what about the dimensions? How can I simplify them? I tried to use UnitConvert, but got an error. See edit to question above. Commented Mar 20, 2022 at 13:41
• Welcome to Mathematica StackExchange. Please, provide your code as a copy-paste text, not as a screenshot. Furthermore, check UnitSimplify. Commented Mar 20, 2022 at 13:41
• @Domen Thanks, I added the code and still have the same problem. Commented Mar 20, 2022 at 13:55
• First of all, do not use character ∇ as part of the symbol name as it gets interpreted as Del[...]. Secondly, as I have proposed, use UnitSimplify and you will get the result in picometres. Thirdly, you can use UnitConvert[testZPF, "Meters"]. Commented Mar 20, 2022 at 13:59

Clear["Global*"]

ω =
2 Pi*Quantity[1,
"SpeedOfLight"]*(1/Quantity[735, "Nanometers"] -
1/Quantity[900, "Nanometers"]);
Subscript[m, red] = Quantity[6, "AtomicMassUnit"];
Subscript[h, bar] = Quantity[1, "ReducedPlanckConstant"];

∇Fn[ω_, m_] := Sqrt[Subscript[h, bar]/(ω*m)]
testZPF = ∇Fn[ω, Subscript[m, red]]


Using the default conversion ("SIBase")

UnitConvert[testZPF]


Using other unit systems may not convert all constants

{#, UnitConvert[testZPF, #]} & /@ {"Conventional", "Imperial",
"Metric", "SI", "SIBase"} // Grid[#, Frame -> All] &


You can convert to any compatible unit, i.e., a distance

UnitConvert[testZPF, # <> "meters"] & /@
{"centi", "milli", "micro", "nano", "pico"}


As pointed out by Domen

UnitSimplify[testZPF]
`