MathGroup Archive 2007

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

Search the Archive

Redefine Arg to return a value from 0 to 2 pi

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80408] Redefine Arg to return a value from 0 to 2 pi
  • From: chuck009 <dmilioto at comcast.com>
  • Date: Tue, 21 Aug 2007 05:09:55 -0400 (EDT)

I'm trying to redefine Arg to return a value from 0 to 2 pi.  However when I do so and then try and plot Arg[z], Mathematica seems to still use the old definition.  Can anybody help me?  This is my code:

(* redefine Arg to return a value from 0 to 2 pi *)

Unprotect[Arg]
Arg[z_] := Module[{z0 = z}, If[Im[z0] < 0, 
         ArcTan[Re[z0], Im[z0]] + 2*Pi, ArcTan[Re[z0], 
           Im[z0]]]]; 
Protect[Arg]

(* check new definition -- this is correct *)

ListPlot[Table[{t, Arg[2*Exp[I*t]]}, {t, 0, 4*Pi, 0.1}]]

(* try and plot new definition of Arg -- Plot used the old definition (-pi to pi) *)

Plot[Arg[2*Exp[I*t]], {t, 0, 4*Pi}]   

(* resore old definition of Arg *)

Unprotect[Arg]
Arg[z_] =. 
Protect[Arg]


  • Prev by Date: RE: Dashing with alternating colors?
  • Next by Date: Unit testing in Mathematica or Wolfram Workbench
  • Previous by thread: Re: Any way to exclude branch-cut fills in this plot?
  • Next by thread: Re: Redefine Arg to return a value from 0 to 2 pi