Python math.atan() Method

Python math 模块Python math Module

Python math.atan(x)Returns the arctangent of x, in radians, with the result ranging from -pi/2 to pi/2.

Python Version: 1.6.1

Syntax

The syntax of math.atan() is as follows:

math.atan(x)

Parameter Description:

  • x-- Required, a positive or negative number. If x is not a number, returns TypeError.

Return Value

Returns a float representing the arctangent of a number, in the range -pi/2 to pi/2.

Example

The following example returns the arctangent of different numbers:

Example

# Import the math package
import math

# Output the arctangent value
print (math.atan(0.39))
print (math.atan(67))
print (math.atan(-21))

Output result:

0.37185607384858127
1.5558720618048116
-1.5232132235179132

Python math 模块Python math Module

Other Extensions