Python math.acos() Method
Python math.acos(x) Returns the arc cosine of x, with the result in the range 0 to pi.
math.acos() accepts arguments 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 floating-point number representing the arccosine of a number.
Example
The following example returns the arccosine of specified numbers:
Example
Import the math package
import
math
Output the arccosine values
(
math
.
acos
(
0.55
)
)
(
math
.
acos
(
0.55
)
)
(
math
.
acos
(
0
)
)
(
math
.
acos
(
1
)
)
(
math
.
acos
(
1
)
)
Output result:
0.9884320889261531
2.15316056466364
1.5707963267948966
0.0
3.141592653589793
Python math Module