Python cos function


Python cos(x) function returns the cosine value of x. The principle values for x is [-∞,∞]. It's a method of math module.

>>> import math
>>> math.cos(math.pi)
-1.0

>>> math.cos(0)
1

>>> math.cos(3 * math.pi/4)
-0.7071067811865475

>>> math.cos(math.pi/3)
-0.5000000000000001



Cosine y=math.cos(x) Graph
X
(deg)
X
(Rad)
Y=cosine(X)
180 ̊ π -1
150 ̊ 5π/6 -0.866025
135 ̊ 3π/4 -0.707107
120 ̊ 2π/3 -0.5
90 ̊ π/2 0
60 ̊ π/3 0.5
45 ̊ π/4 0.707107
30 ̊ π/6 0.866025
0 ̊ 0 1