logo

Python Number Atan() Method


Show

Description

The atan() method in Python number is supposed to return the arc tangent of x, in terms of radians. The atan() function is a library method of the Python math module and is thus used to get the arc tangent, as it accepts the number and thus returns the arc tangent value of the specific number.

Syntax

Here is the syntax for atan() method:

atan(x)

Note - One cannot access this function directly, so it is required to import the math module in Python and then we are supposed to call this function making use of the math static object.

Parameters

  • x - This should be a numeric value.

Return Value

This method in the Python math module returns an arc tangent of x, in radians.

Example

The example below shows the usage of atan() method.

#!/usr/bin/python
import math

print "atan(0.64) : ",  math.atan(0.64)
print "atan(0) : ",  math.atan(0)
print "atan(10) : ",  math.atan(10)
print "atan(-1) : ",  math.atan(-1)
print "atan(1) : ",  math.atan(1)

When we run above program, it produces following result:

atan(0.64) :  0.569313191101
atan(0) :  0.0
atan(10) :  1.4711276743
atan(-1) :  -0.785398163397
atan(1) :  0.785398163397

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.