MathGroup Archive 2003

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

Search the Archive

RE: Weirdness with symbol Degree vis Units

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40652] RE: [mg40616] Weirdness with symbol Degree vis Units
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 12 Apr 2003 03:10:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Frank,

I'm not certain if I totally understand your question. Did you use an N
somewhere to convert to approximate numbers?

In any case, WRI made a slip up because they used Degree both as a number
constant and as a unit. The result is that if you try to use the Units
package to convert an approximate number to Degree, Degree is converted back
to an approximate number and that immediately undoes the conversion!

Needs["Miscellaneous`Units`"]

The following works...

Convert[6 Milli Radian, Degree]   giving
(27*Degree)/(25*Pi)

But if you try to convert an approximate number value...

Convert[6.0 Milli Radian, Degree]
0.006

and you are right back where you started.

If you want to try the Miscellaneous`V4ExtendUnits package at my web site
below, it corrects the problem.

Needs["Miscellaneous`V4ExtendUnits`"]

6.0 Milli Radian // ToUnit[Degree]
%//FullForm
0.343775 °
Times[0.34377467707849396`, HoldForm[Degree]]

V4ExtendUnits converts to a fake degree and then puts the resulting Degree
symbol in a HoldForm to prevent undoing the conversion. The package has many
other features, including the ability to define and use your own units, or
synonyms for standard unit expressions such as GeV for Giga ElectronVolt.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Frank Iannarilli [mailto:frankeye at cox.net]
To: mathgroup at smc.vnet.net

Hi,

I threw myself for a loop, trying the following:

Needs["Miscellaneous`Units`"]

Convert[6 Milli Radian, Degree]
   > 0.006

Convert[6 Milli Radian, 1/Degree]
   > 0.006

(* Huh?? What's going on here?? *)

Context[Degree]
   > System`

N[Degree]
   > 0.0174533  (* same as it ever way... *)

Oh, thought I...the Help Browser, when viewing the
StandardAddons/Miscellaneous/Units, lists Degree as a units symbol for
angle. So I'd better reference it with its context:

Convert[6. Milli Radian, Miscellaneous`Units`Degree]
   > Convert::incomp : Incompatible units in 6 Milli Radian and
Degree.

N[Degree]
   > Degree  (* Huh?? *)

It turns out that the Units package does NOT in fact introduce its own
Degree symbol:  (reference:
http://support.wolfram.com/mathematica/kernel/Symbols/Miscellaneous/Units/in
dex.html).

Nevertheless, I inadvertently introduced it myself with the most
recent Convert[] invocation above.  So to get things back to "normal"
I had to Remove it:

Remove[Miscellaneous`Units`Degree]

But now, notwithstanding the somewhat misleading documentation, my
question still remains:  Why can't I have Convert[] give me an
"non-surprising" behavior when attempting to convert to Degree?  Must
I treat the Degree symbol as a special case, w.r.t. use of units?

TIA!



  • Prev by Date: Re: Weird Problem on an old Macintosh
  • Next by Date: Re: Opinions about the "Oneliners"
  • Previous by thread: Re: Weirdness with symbol Degree vis Units
  • Next by thread: Re: RE: Weirdness with symbol Degree vis Units