Bad Math Module Notation re: atan2

Harald Hanche-Olsen hanche at math.ntnu.no
Fri Jun 2 09:59:12 EDT 2000


+ Lou Pecora <pecora at anvil.nrl.navy.mil>:

| Maybe you've all kicked this around before, but I've just picked up
| Python in the last month or so.  The notation for atan2(x,y) is 
| 
|  atan2(x,y)= arctangent( x/y)
| 
| Given the usual association of x with the abscissa and y with the
| ordinate in mathematics, science and engineering it is easy to mistake
| atan2(x,y) as arctangent (y/x) (x and y reversed!).  Or in another
| view, according to the majority of mathematically trained people
| atan2(x,y) as defined appears to deliver the arccotangent.  
| 
| Am I mising something?

Yes.  The documentation (meaning the library reference) is wrong, but
the implementation is right:

>>> math.atan2(0,1)
0.0
>>> math.atan2(1,0)
1.57079632679

In fact, even the function's doc string is right (Py 1.5.2):

>>> print math.atan2.__doc__
atan2(y, x)

Return atan(y/x).

you-should-listen-to-what-they-do-but-not-what-they-say-ly y'rs,
-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- "There arises from a bad and unapt formation of words
   a wonderful obstruction to the mind."  - Francis Bacon



More information about the Python-list mailing list