This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: addition of cmath.arg function
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: gvanrossum, johnw42, loewis, rhettinger, tim.peters
Priority: normal Keywords: patch

Created on 2002-04-16 23:11 by johnw42, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
complex_arg.diff johnw42, 2002-04-16 23:11 diff file for Module/cmathmodule.c
Messages (7)
msg39614 - (view) Author: John Williams (johnw42) Date: 2002-04-16 23:11
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
msg39615 - (view) Author: John Williams (johnw42) Date: 2002-04-19 17:38
Logged In: YES 
user_id=44174

I forgot to mention this patch is relative to version 2.2.1.
msg39616 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-22 17:53
Logged In: YES 
user_id=6380

For Tim to pronounce.
msg39617 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-04-22 18:08
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>?
msg39618 - (view) Author: John Williams (johnw42) Date: 2002-04-22 19:17
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?
msg39619 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-06-26 08:05
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.
msg39620 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-07 21:26
Logged In: YES 
user_id=21627

Since Raymond's analysis is uncommented, I reject this 
patch. John, if you can find a rationale for this change based 
on practicality, not purity, feel free to post it here - we will still 
see your comments.
History
Date User Action Args
2022-04-10 16:05:13adminsetgithub: 36446
2002-04-16 23:11:32johnw42create