5
$\begingroup$

Suppose I want to express $3h$ in units of $\hbar$ (where $h$ and $\hbar$ are the Planck constant and reduced Planck constant, respectively). By definition, $h = 2\pi\hbar$, but when I attempt this conversion using Mathematica's built-in unit functions,

UnitConvert[Quantity[3, "PlanckConstant"], "ReducedPlanckConstant"]
    (* => 18.84956 ℏ *)

I obtain a non-exact (floating-point) result.

In general, I've observed that whenever I want to convert between two units for which there is an irrational (but exactly known) conversion factor (e.g. a multiple of $\pi^n$), Mathematica fails to give the exact result. Is there a way to fix this?

$\endgroup$
6
$\begingroup$
UnitConvert[Quantity[3, "PlanckConstant"], "ReducedPlanckConstant"] /.
  x_?NumericQ :> RootApproximant[x/Pi]*Pi

Quantity[6*Pi, "ReducedPlanckConstant"]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.