acos()

The inverse of cos(), returns the arc cosine of a value.

Examples

1
2
3
4
5
6
def setup():
    a = py5.PI
    c = py5.cos(a)
    a_c = py5.acos(c)
    # prints "3.1415927 : -1.0 : 3.14159261"
    py5.println(round(a, 8), ':', round(c, 8), ':', round(a_c, 8))
1
2
3
4
5
6
def setup():
    a = py5.PI + py5.PI/4
    c = py5.cos(a)
    a_c = py5.acos(c)
    # prints "3.92699087 : -0.70710674 : 2.35619443"
    py5.println(round(a, 8), ':', round(c, 8), ':', round(a_c, 8))

Description

The inverse of cos(), returns the arc cosine of a value. This function expects the values in the range of -1 to 1 and values are returned in the range 0 to PI.

This function makes a call to the numpy acos() function.

Syntax

acos(value: float) -> float

Parameters

  • value: float - value in the range of -1 to 1 whose arc cosine is to be returned

Updated on September 11, 2021 16:51:34pm UTC