       Re: issues with unit package

• To: mathgroup at smc.vnet.net
• Subject: [mg88653] Re: issues with unit package
• From: "David Park" <djmpark at comcast.net>
• Date: Sun, 11 May 2008 15:15:39 -0400 (EDT)
• References: <g03v60\$bpi\$1@smc.vnet.net>

```Mathematica does not automatically apply unit conversions just because you
have loaded the Units package. How would it know what form of units you
wanted? You have to tell it to convert units with the Convert statement.

Needs["Units`"]
Needs["PhysicalConstants`"]

Freq = 100*^6 Hertz;
Wavelength = SpeedOfLight/Freq
Convert[N[Wavelength], Meter]                        giving
(149896229 Meter)/(50000000 Hertz Second)
2.99792 Meter

3 Ohm + 1 Volt/Ampere;
Convert[%, Ohm]
4 Ohm

I'm not certain why SI did not do anything on the second example. Apparently
there is a difference between SI units and base SI units. If you use the
ExtendUnits6` package from my web site you can use BaseSI and ToUnit as a
postfix method of converting:

Needs["Units6`ExtendUnits6`"]

3 Ohm + 1 Volt/Ampere;
% // BaseSI
% // ToUnit[Ohm]
(4 Kilogram Meter^2)/(Ampere^2 Second^3)
4. Ohm

With ExtendUnits6 you can also set up reduced units. Let's set up a system
where the ElectronCharge and SpeedOfLight are both set to 1.

SetupReducedUnits[{ElectronCharge, SpeedOfLight}, {Meter, Kilogram,
Kelvin}]
{Ampere -> 2.08194*10^10/Meter, Second -> 2.99792*10^8 Meter}

Then we can take you second example through various equivalent reduced
units.

3 Ohm + 1 Volt/Ampere;
% // ReducedUnits
ReducedEquivalent[%, Kilogram Meter, Volt Meter]
ReducedEquivalent[%, Volt Meter, Ohm]
3.425*10^-46 Kilogram Meter
1.92128*10^-10 Meter Volt
4. Ohm

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

"Jay Ortiz" <omaha8master at yahoo.com> wrote in message
news:g03v60\$bpi\$1 at smc.vnet.net...
> Why won't Mathematica when using the Units package eliminate reciprocal
> units?   Consider an example from E&M, finding the wavelength
> corresponding to a frequency:
>
> <<Units`
> <<PhysicalConstants`
>
> In:=
> Freq=100*^6 Hertz;
>  Wavelength=SpeedOfLight/Freq
> Out=(149896229*Meter)/(50000000*Hertz*Second)
> In:=N[Wavelength]
> Out=(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:=3 Ohm + 1 Volt/Ampere
> Out =  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
> Mathematica 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
> quantities that have units.  Am I missing something here?
>
> Thanks.
>

```

• Prev by Date: Re: Re: DynamicModule question
• Next by Date: Re: issues with unit package
• Previous by thread: Re: issues with unit package
• Next by thread: Re: issues with unit package