MathGroup Archive 2008

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

Search the Archive

Re: Calculating with Units

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94021] Re: Calculating with Units
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 2 Dec 2008 00:42:04 -0500 (EST)

On 12/1/08 at 7:02 AM, Nikolaus at rath.org (Nikolaus Rath) wrote:

>Until now, I have always defined my units manually in terms of the 4
>base units Kilogram, Meter, Coulomb and Second:

>Newton = Kg Meter / Second^2; Joule = Newton Meter; Henry = Weber /
>Ampere; Weber = Volt Second; etc.

>This allows me to evaluate expressions like

>B = (\[Mu] Ii)/(2 \[Pi] r);

>B /. { r -> 20 Meter, \[Mu] -> 4 \[Pi]  * 10^-7 Henry/Meter,
>Ii -> 2 Ampere}

>% / Tesla

>and directly see if the units in the final result are correct.

>But since all these units (and many more) are already defined in the
>Mathematica Units package, I was wondering if there isn't a way to
>use that package in the same way. Unfortunately, it doesn't seem to
>simplify the units, i.e. when I enter

>(Ampere Henry)/(Meter Meter) // Simplify // SI

>I get the same expression back. What I would like to get is either
>"Tesla" or "Kilo Gram / (Coulomb Second)".  Is there a way to
>accomplish this?

There is a rule in the Units`Private` context that will do much
of what you want. That is $ToFundamental. It can be accessed as follows:

In[5]:= (Ampere Henry)/(Meter Meter) //. Units`Private`$ToFundamental

Out[5]= Kilogram/(Ampere Second^2)

This isn't quite what you asked for mainly because Coulomb is a
derived unit in the SI system. However, I've found using this
enables me to more easily check the results of a computation and
verify the units are correct.


  • Prev by Date: Re: Copying text out of mathematica
  • Next by Date: Re: Quick help needed very much!!!!
  • Previous by thread: Re: Calculating with Units
  • Next by thread: Re: Calculating with Units