MathGroup Archive 2008

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

Search the Archive

Re: issues with unit package

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88725] Re: issues with unit package
  • From: John Jowett <John.M.Jowett at gmail.com>
  • Date: Wed, 14 May 2008 06:05:25 -0400 (EDT)
  • References: <g03v60$bpi$1@smc.vnet.net> <g07gtt$8s5$1@smc.vnet.net>

Hello,

I encountered most of the questions discussed here several years ago
and implemented an extension to the combined Units, PhysicalConstants
and Notation packages called Accelerator`ConstantsUnits`.

Among other things, it contains a function ToFundamentalSI which
reduces all expressions containing units to a (unique) canonical form
in terms of the four "fundamental" SI units.   In the process it
replaces things like Sqrt[Meter^2] by Meter but without doing a
PowerExpand on the full expression.  This has been implemented in the
upgrade of the package for Mathematica Version 6.

Version 4.0 of the package (for Mathematica V6) is essentially
complete and can be obtained from me on request by email.   I will
release it more generally when I get time.

John Jowett




On May 11, 9:20 pm, Szabolcs Horv=E1t <szhor... at gmail.com> wrote:
> Jay Ortiz wrote:
> > Why won't Mathematica when using the Units package eliminate reciprocal =
units?   Consider an example from E&M, finding the wavelength correspondin=
g to a frequency:
>
> > <<Units`
> > <<PhysicalConstants`
>
> > In[1]:=
> >  Freq=100*^6 Hertz;
> >   Wavelength=SpeedOfLight/Freq
> > Out[1]=(149896229*Meter)/(50000000*Hertz*Second)
> > In[2]:=N[Wavelength]
> > Out[2]=(0.299792*Meter)/(Hertz*Second)
>
> > i.e. Mathematica doesn't know that Meter/(Hertz Second) should reduce to=
 Meter.   Shouldn't this be handled?
>
> > Another example; shouldn't Mathematica reduce expressions in consistent =
units to a single result?    Example:
>
> > In[5]:=3 Ohm + 1 Volt/Ampere
> > Out[5] =  3 Ohm + 1 Volt/Ampere
>
> > Why not 4 Ohm, or 4 Volt/Ampere?   After all, the documentation entry =
for Ohm says it's equivalent to Volt / Ampere, so it's reasonable that Mathe=
matica would be aware of that relationship.  Doing SI[] or MKS[] on those =
expressions doesn't change anything.
>
> > Maybe the Units package doesn't extend to manipulating variables with qu=
antities that have units.  Am I missing something here?
>
> I don't think that a completely automatic "reduction" of units would be
> possible.  But it would be nice if the Units package provided a function=

> to convert units to one or more canonical forms.
>
> This will work in many (but not all) cases:
>
> toCanonical[expr_] := SI[expr] //. Units`Private`$ToFundamental
>
> In[5]:= toCanonical[3 Ohm + 1 Volt/Ampere]
> Out[5]= (4 Kilogram Meter^2)/(Ampere^2 Second^3)
>
> In[6]:= toCanonical[(0.299792*Meter)/(Hertz*Second)]
> Out[6]= 0.299792 Meter
>
> It is not always clear what the appropriate unit is in certain
> situations.  For example what is the appropriate unit for the torque?
> Joule is certainly correct dimensionally, but is it reasonable to use it?-=
 Hide quoted text -
>
> - Show quoted text -



  • Prev by Date: Re: Display commands in a package
  • Next by Date: Re: Testing TOC sidebar palette
  • Previous by thread: Re: issues with unit package
  • Next by thread: EventHandler problem