why no arg, abs methods for comlex type?

Terry Reedy tjreedy at udel.edu
Fri Aug 5 16:07:12 EDT 2005


"Daniel Schüle" <uval at rz.uni-karlsruhe.de> wrote in message 
news:dd03cn$f7c$1 at news2.rz.uni-karlsruhe.de...
> > I agree that this is a deficiency.  I would think .angle() should be a
>
> I don't know what nomenclature is used in english speaking
> mathematical world for angle of a complex number
> I learned it in german as Arg(z) .. Arg standing for argument
> you see, we would have named it differently, hence making
> it difficult for the reader, eventually creating redundancy

I am aware of the usage of argument to mean the angle in polar 
representation, but I don't like it.  The word argument already has two 
other meanings, one in common English, the other in math/CS.  The latter 
meaning is the inputs to a function, and that is how the word is used in 
Python (though the former applies more to many c.l.p threads ;-)  To me, 
the polar angle has no connection with either meaning and so the usage is 
'like Greek' to me.  Whereas angle is exactly what it is.

As for Greek: I first learned r(adius),theta (versus x,y or real,imag) as 
the names for polar coordinates or the polar representation for complex 
numbers and only ran into arg much later in some contexts.  And I have seen 
complex number implementations that use the equivalent of c.r() and 
c.theta().  But I did not suggest that for one of the reasons I don't like 
'lambda': its fine if you already know it and arbitrary if you don't.  (Is 
theta used in Germany?)

> > It is possible that a cmath2 module, written in  Python, could be 
> > useful.
>
> I hope so
> I will google for cmath2, I never heard about it

That is because we have not written it yet.  The allroots function could be 
the first addition, if it is not present elsewhere.  The 'could be' was 
meant in the sense of 'if someone were to write it' rather than 'if you 
were to read it' ;-)

Terry J. Reedy






More information about the Python-list mailing list