Python math.acos() Method
Python math.acos(x)Returns the arc cosine of x, in the range 0 to pi.
The parameter accepted by math.acos() ranges from -1 to 1.
math.acos(-1) returns the math.pi constant.
Python Version: 1.4
Syntax
The syntax of the math.acos() method is as follows:
math.acos(x)
Parameter Description:
- x-- Required. A number between -1 and 1. If x is not a number, a TypeError is returned.
Return Value
Returns a float value representing the arc cosine of a number.
Example
The following example returns the arc cosine of the specified numbers:
Example
# Import the math package
import math
# Output the arc cosine value
print(math.acos(0.55))
print(math.acos(-0.55))
print(math.acos(0))
print(math.acos(1))
print(math.acos(-1))
import math
# Output the arc cosine value
print(math.acos(0.55))
print(math.acos(-0.55))
print(math.acos(0))
print(math.acos(1))
print(math.acos(-1))
Output result:
0.9884320889261531 2.15316056466364 1.5707963267948966 0.0 3.141592653589793Other Extensions
Python math Module