Re: Calculating with Units
- To: mathgroup at smc.vnet.net
- Subject: [mg94084] Re: Calculating with Units
- From: John Jowett <John.M.Jowett at gmail.com>
- Date: Thu, 4 Dec 2008 07:16:39 -0500 (EST)
- References: <gh2h7e$ica$1@smc.vnet.net>
I've mentioned my Accelerator`ContantsUnits` package before on this group but it is now available for download from http://jowett.home.cern.ch/jowett/Mathematica/Accelerator/ConstantsUnits.ht= ml Among many other things, it implements what Bill Rowe suggests below in a function ToFundamentalSI[ ] but goes further in simplifying expressions like Sqrt[Meter^2/Second^2] without applying PowerExpand to other symbols in the expression. If you download the package please let me know and give feedback. Documentation is not ideal but there are numerous examples in the package-defining notebook. John Jowett On Dec 2, 6:31 am, Bill Rowe <readn... at sbcglobal.net> wrote: > On 12/1/08 at 7:02 AM, Nikol... 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.- Hide quoted text - > > - Show quoted text -
- Follow-Ups:
- FactorInteger bug ???
- From: Artur <grafix@csl.pl>
- FactorInteger bug ???