Python math.acos()

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

In Python, the math.acos() function returns the arc cosine (inverse cosine) of a number, expressed in radians.

  • 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.acos(x)
  • x: A number between -1 and 1 representing the cosine value for which the arc cosine is to be calculated.

The math.acos() function returns a numeric value in the range [0, π] in radians, which represents the inverse cosine of the value x.

Example

The example below demonstrates how to use the math.acos() function to calculate the arc cosine of 0:

import math
print(math.acos(0))

The above example gives the following output:

1.5707963267948966

Codebyte Example

The following codebyte example shows how the math.acos() function works:

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