16
$\begingroup$

Is there a way to use the physical constants in calculations and have Mathematica 10 figure out the final unit and numerical magnitude? When I try

pcM = N[Quantity[1, "PlanckConstant"]]

I simply get 1. h without the numerical value of Planck constant. Subsequently, using this in all further steps, keeps the answer in h and does not work out units.

However, if I define the Planck constant by hand and use it in a calculation, everything works as expected. I am curious as to why the internally defined constants do not show up with numerical values.

Thanks,

$\endgroup$
3
  • $\begingroup$ what would you like the result to be, i.e. which units should it be with respect to? $\endgroup$
    – chuy
    Commented Aug 27, 2014 at 15:19
  • 5
    $\begingroup$ I learned just a few days ago that one can (often) use UnitConvert for this sort of thing. In[199]:= UnitConvert[Quantity[1, "PlanckConstant"]] Out[199]= Quantity[6.626070*10^-34, ( "Kilograms" ("Meters")^2)/("Seconds")] $\endgroup$ Commented Aug 27, 2014 at 15:20
  • 3
    $\begingroup$ or In[647]:= UnitConvert[Quantity[1, "PlanckConstant"], "eV*s"] Out[647]= Quantity[4.135668*10^-15, "Electronvolts" "Seconds"] $\endgroup$
    – chuy
    Commented Aug 27, 2014 at 15:22

2 Answers 2

23
$\begingroup$

In physics, the Planck constant may be used as a natural unit.

If you want to switch to another unit system, use UnitConvert[].

For example, you can switch to standard SI units this way:

UnitConvert[Quantity[1, "PlanckConstant"], "SIBase"]

which will give you:

Quantity[6.626070*10^-34, ("Kilograms" ("Meters")^2)/("Seconds")]

This can be done at the end of calculation.

If you like to get rid of Quantity head, just do:

QuantityMagnitude[%]

which outputs:

6.626070*10^-34
$\endgroup$
4
  • 1
    $\begingroup$ you can also use QuantityMagnitude to get the value out. $\endgroup$
    – chuy
    Commented Aug 27, 2014 at 15:29
  • $\begingroup$ @chuy, indeed, thank you! $\endgroup$ Commented Aug 27, 2014 at 15:31
  • 3
    $\begingroup$ Or just UnitConvert without the second argument, which assumes SI units. $\endgroup$
    – Mark Adler
    Commented Aug 28, 2014 at 3:40
  • $\begingroup$ @MarkAdler: definitely right! Though, of course, using the second argument is a bit more general. For example, in engeneering applications one unit measure can be used and in spectroscopy - something totally different. $\endgroup$ Commented Aug 28, 2014 at 8:04
1
$\begingroup$

You should use the Physical Constants Package by using

<< PhysicalConstants`

When you enter now

PlanckConstant

you directly get the Planck Constant. With

PlanckConstant/(Joule Second)

you get the Planck Constant without units.

$\endgroup$
1
  • 1
    $\begingroup$ True, but note that PhysicalConstants package is obsolete and has been biult into Mathematica since version 9. $\endgroup$ Commented Aug 27, 2014 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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