Python 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.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

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

All contributors

Contribute to Docs

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours