[Patches] [ python-Patches-544909 ] addition of cmath.arg function

noreply@sourceforge.net noreply@sourceforge.net
Wed, 26 Jun 2002 01:05:33 -0700


Patches item #544909, was opened at 2002-04-16 18:11
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=544909&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: John Williams (johnw42)
Assigned to: Tim Peters (tim_one)
Summary: addition of cmath.arg function

Initial Comment:
This patch adds the familiar "Arg" function from
complex analysis to the cmath module, though it's
called "arg" here for consistency with the other names.
Along with the built-in abs function this makes
polar/rectangular coordinate conversions trivial:

  z = complex(x,y)
  r, theta = abs(z), arg(z)
  
  z = r * exp(1j * theta)
  x, y = z.real, z.imag

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-06-26 03:05

Message:
Logged In: YES 
user_id=80475

It takes only a couple of minutes to get used to the existing 
functions, so I don't think any of the three should be added.

----------------------------------------------------------------------

Comment By: John Williams (johnw42)
Date: 2002-04-22 14:17

Message:
Logged In: YES 
user_id=44174

You have a good point; the functions you suggest *are* a lot
closer to what is needed in practice, but at the same time
something just bothers me about a function I learned about
in the first week of complex analysis not being in the
complex math module--kind of like saying you don't need tan
since it's just really just sin/cos.

How would you feel about adding all three?

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2002-04-22 13:08

Message:
Logged In: YES 
user_id=31435

It's hard to know what to say -- since it's really just an 
alias for math.atan2, it's hard to get excited about.  
Might it be even more convenient to add

cmath.polar(complex) -> (abs, arg)
cmath.rect(abs, arg) -> complex

functions?  That is, what do you *really* want <wink>?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-04-22 12:53

Message:
Logged In: YES 
user_id=6380

For Tim to pronounce.

----------------------------------------------------------------------

Comment By: John Williams (johnw42)
Date: 2002-04-19 12:38

Message:
Logged In: YES 
user_id=44174

I forgot to mention this patch is relative to version 2.2.1.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=544909&group_id=5470