Tangents and the like...

zzzzz zzizz_ at notmail.com
Thu Apr 12 22:29:42 EDT 2001


On Thu, 12 Apr 2001 18:01:43 -0600, Mitch Chapman
<chapman at bioreason.com> wrote:

>Mark Rowe wrote:
>> Just been reading through the Math modules documentation and i can't see any
>> way to find the inverse tangent of a number....  I know that this is
>> possible, but how?
>
>>>> import math
>>>> math.pi/4.0
>0.785398163397
>>>> math.atan(1.0)
>0.785398163397
>>>> math.atan2(1.0, 1.0)
>0.785398163397

Also use atan2(y,x) to get the angle from -pi < theta < pi whereas if
you use atan you'll only get -pi/2 < result < pi/2 which will _not_ be
the same as the real angle.
eg)
>>> math.atan2(-10,-10)*180/math.pi
-135.0




More information about the Python-list mailing list