MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Get numbers out of PhysicalConstants?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62616] Re: Get numbers out of PhysicalConstants?
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 29 Nov 2005 06:43:19 -0500 (EST)
  • References: <dme8l6$inj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Wonseok,
One way to achieve what you want is to replace all the units by 1.
Toward this aim you may use a function from Miscellaneous`Units`Private` 
called UniqueCasesUnit:

UniqueCasesUnit[expr_]:=
   Union[Cases[
       expr,_Symbol?((MatchQ[#,_Symbol]&&(MemberQ[{"Miscellaneous`Units`",
                         "Miscellaneous`SIUnits`"},Context[#]]|| 
             MemberQ[{Second,Newton,Degree,Circle,Point,Last,Drop,
                         Gamma,Byte},#]))&),Infinity]]

that gives you the units of an expression.

With this we can extract the numerical part of an expression by e.g. 
VacuumPermeability:

<< Miscellaneous`PhysicalConstants`
  << Miscellaneous`Units`
(t = VacuumPermeability) /. ((# -> 1) & /@ \
Miscellaneous`Units`Private`UniqueCasesUnit[t])

Daniel

Wonseok Shin wrote:
> Hello,
> 
> Is there any way to get numbers out of the constants defined in
> Miscellaneous`PhysicalConstants` package?  Carrying units all the time
> is inconvenient in calculation.
> 
> For example,
> In[1]:= << Miscellaneous`PhysicalConstants`
> In[2]:= VacuumPermeability
> Out[2]= \!\(\(p\ Second\ Volt\)\/\(2500000\ Ampere\ Meter\)\)
> 
> I want to get the number p/2500000 out of VacuumPermeability, without
> units.  How can I do this?
> 


  • Prev by Date: Re: Avoiding usage of function brackets
  • Next by Date: Re: FW: 3D plot question
  • Previous by thread: Re: Get numbers out of PhysicalConstants?
  • Next by thread: Re: Get numbers out of PhysicalConstants?