Free cookie consent management tool by TermsFeed The acos() function - Python math module | Pythontic.com

The acos() function - Python math module

Function signature:

acos(ratio)

Return value:

Returns the angle value corresponding to the cosine value.

Overview:

  • The Python function arccos() from the math module is an inverse trigonometric function that returns the angle between adjacent and the hypotenuse.
  • The input to the arccos() function is the cosine value of a given angle.

The acos() function of Python math module

Example:

# Example python program that returns the 
# angle values between the adjacent and the hypotenuse 
# from the given cosine values.
import math

# Popular cosine values in fractions (for the angles)
# 0, 30, 45, 60, 90
cosineValues = [1, math.sqrt(3)/2, math.sqrt(2)/2, 1/2, 0]

# Find the arccos values
angles = []
for cosine in cosineValues:
    angle = math.acos(cosine)
    angles.append(angle)

print("Angle in radians:")
for angle in angles:
    print(angle)

print("Angle in degrees:")
for angle in angles:
    print(math.degrees(angle))

Output:

# Example python program that returns the 
# angle values between the adjacent and the hypotenuse 
# from the given cosine values.
import math

# Popular cosine values in fractions (for the angles)
# 0, 30, 45, 60, 90
cosineValues = [1, math.sqrt(3)/2, math.sqrt(2)/2, 1/2, 0]

# Find the arccos values
angles = []
for cosine in cosineValues:
    angle = math.acos(cosine)
    angles.append(angle)

print("Angle in radians:")
for angle in angles:
    print(angle)

print("Angle in degrees:")
for angle in angles:
    print(math.degrees(angle))

 


Copyright 2025 © pythontic.com