math.atan()

Anonymous contributor's avatar
Anonymous contributor
Published Sep 26, 2024
Contribute to Docs

The math.atan() function returns the arctangent of a given number, which is the angle in radians whose tangent equals that number. It can accept any real number, representing the slope of a line.

Syntax

math.atan(x)
  • n: The number for which the arctangent is to be calculated. This can be any real number.

The math.atan() function returns the inverse tangent of the value x, which is the angle in radians. The result lies within the range of -π/2 to π/2 radians.

Example

The example below demonstrates the use of the math.atan() function:

import math
print(math.atan(1))

The above code gives the following output:

0.7853981633974483

Codebyte Example

Run the following example that uses the math.atan() function to understand its working:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Python on Codecademy