import math
print(math.cos(1)) # 0.5403023058681398
print(math.cos(0.56)) # 0.8472551110134161
print(math.cos(-0.56)) # 0.8472551110134161
print(math.cos(-1)) # 0.5403023058681398
print(math.cos(0)) # 1.0
print(math.cos(math.pi)) # -1.0
Note that all the inputs are in radian. import math
in_degree = 90
in_redian = math.radians(in_degree)
print(math.cos(in_redian)) # 6.123233995736766e-17
import matplotlib.pyplot as plt
x=[]
y=[]
i=0
while (i<=8):
x.append(i)
y.append(math.cos(i))
i=i+0.1
plt.plot(x,y)
plt.axvline(x=0.00,linewidth=2, color='#f1f1f1')
plt.axhline(y=0.00,linewidth=2, color='#f1f1f1')
plt.grid(linestyle='-', linewidth=0.5,color='#f1f1f1')
plt.show()
acos()
asin() sin() tan()
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.