MathGroup Archive 2008

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

Search the Archive

Re: Calculating with Units

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94011] Re: [mg93997] Calculating with Units
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 2 Dec 2008 00:40:17 -0500 (EST)
  • References: <27514307.1228134307900.JavaMail.root@m02>

The Unit6`ExtendUnits1 package from my web site ($30) has a BaseSI command
that does the conversion you want.

Needs["Units6`ExtendUnits6`"]

B = (\[Mu] Ii)/(2 \[Pi] r);
B /. {r -> 20 Meter, \[Mu] -> 4 \[Pi]*10^-7 Henry/Meter, 
   Ii -> 2 Ampere};
%/Tesla
% // BaseSI
(Ampere Henry)/(50000000 Meter^2 Tesla)
1/50000000

(Ampere Henry)/(Meter Meter) // BaseSI
% // ToUnit[Tesla]
Kilogram/(Ampere Second^2)
1. Tesla

The package has many other features.
1) It is easier to convert units as a postfix operation.
2) It has a PrefixForm for automatically picking correct unit prefixes if
desired.
3) You can parse a unit into compatible descending units such as Hour,
Minute, Second.
4) You can simultaneously convert to a set of equivalent units. 
5) It has simpler temperature conversions.
6) It has general decibel conversions.
7) You can install your own units or synonyms for units. For example GeV for
Giga ElectronVolt or mph for Mile/Hour.
8) You can deunitize unit expressions to any compatible set of input and
output units for numerical work.
9) You can use reduced units where certain physical constants are set to 1.
Examples would be geometric units in relativity and gravitation or atomic
units in atomic physics.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark 


From: Nikolaus Rath [mailto:Nikolaus at rath.org] 


Hello,

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?

 
Best,
 

   -Nikolaus

--
 =C2=BBIt is not worth an intelligent man's time to be in the majority.
  By definition, there are already enough people to do that.=C2=AB
                                                         -J.H. Hardy

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C




  • Prev by Date: Re: Re: Comment display style?
  • Next by Date: Re: Re: Re: Floating-Point Computing
  • Previous by thread: Re: Calculating with Units
  • Next by thread: Re: Calculating with Units