Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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,

share|improve this question
    
what would you like the result to be, i.e. which units should it be with respect to? –  chuy Aug 27 at 15:19
4  
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")] –  Daniel Lichtblau Aug 27 at 15:20
2  
or In[647]:= UnitConvert[Quantity[1, "PlanckConstant"], "eV*s"] Out[647]= Quantity[4.135668*10^-15, "Electronvolts" "Seconds"] –  chuy Aug 27 at 15:22

2 Answers 2

up vote 8 down vote accepted

In physics 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
share|improve this answer
1  
you can also use QuantityMagnitude to get the value out. –  chuy Aug 27 at 15:29
    
@chuy, indeed, thank you! –  Alexey Bobrick Aug 27 at 15:31
1  
Or just UnitConvert without the second argument, which assumes SI units. –  Mark Adler Aug 28 at 3:40
    
@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. –  Alexey Bobrick Aug 28 at 8:04

You should use the Physical Constants Package by using

<< PhysicalConstants`

When you enter now

PlanckConstant

you directly get the Plack Constant. With

PlanckConstant/(Joule Second)

you geht the Planck Constant without units.

share|improve this answer
    
True, but note that PhysicalConstants package is obsolete and has been biult into Mathematica since version 9. –  Alexey Bobrick Aug 27 at 15:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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