MathGroup Archive 1991

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

Search the Archive

Bug report: Graphics`ArgColors`

  • To: mathgroup at
  • Subject: Bug report: Graphics`ArgColors`
  • From: lsf at (Sam Finn)
  • Date: Sat, 19 Oct 91 15:32:36 CDT

Mathematica 2.0 Standard Package Graphics`ArgColors`

L. S. Finn//lsf at

License L2086-7328

There are (at least) three (count'em) bugs in this package.

1) ArgColor[0] evaluates to an RGBColor[]; otherwise ArgColor[] evaluates to
   a Hue[]. This can produce a pcolor error if the surface you are shading
   passes through zero. 

2) The domain of Hue[] is [0..1], while the range of Arg[] is [-Pi, Pi].
   Thus, the mapping that ArgColor and ColorCircle provide from complex z
   to Hue[] is, in principle, undefined for half the complex plane. In fact,
   Hue seems to do the right thing, but this should not be counted on. Note
   that ArgShade is properly protected against this sort of thing.

3) The rule for non-zero arguments to ArgColor[] has a typo: it is

ArgColor[z_] := ColorCircle[ Arg[z] ] /; NumberQ[N[arg]]

   and it ought to be

ArgColor[z_] := ColorCircle[ Arg[z] ] /; NumberQ[N[z]]

Recommended replacements for ArgColor[] and ColorCircle[] follow below:

(* don't mix Hue[] and RGBColor[] *)
ArgColor[z_] := Hue[1,0,1] /; z == 0.0  

(* typo in package *)
ArgColor[z_] := ColorCircle[ Arg[z] ] /; NumberQ[N[z]] 

(* Adjust range of ColorCircle[] to match domain of Hue[] *)
ColorCircle[arg_, light_:1.0] := 
    Hue[ N[Mod[arg/2/Pi,1]], 1, light] /; NumberQ[N[arg]] 


L. S. Finn

  • Prev by Date: Re: Switch and List: How to combine?
  • Next by Date: Mma 1.2 memory management bug (not in 2.0)
  • Previous by thread: Mathematica class
  • Next by thread: Mma 1.2 memory management bug (not in 2.0)