cos() math function in python by R4R Team

- cos() is python math function which determine the cosine value of number.

Syntax-

math.cos(x)

- Here x should be a numeric value.
- it return the sine value of x in radians.

Example-

cos(0) will return 0.5253219888177297
cos(90) will -0.4480736161291701


program-

import math

#these value are in radians
print("cos(90) : ",math.cos(90))
print("cos(0) : ",math.cos(0))
print("cos(45) : ",math.cos(45))
print("cos(60) : ",math.cos(60))
print("cos(10) : ",math.cos(10))


output-

cos(90) : -0.4480736161291701
cos(45) : 1.0
cos(0) : 0.5253219888177297
cos(30) : -0.9524129804151563
cos(10) : -0.8390715290764524


-If we want to print the cosine value of x, consider x should be in degree then


program-

import math
#these value are in degree
n=math.pi/180
print("cos(90) : ",math.cos(90*n))
print("cos(0) : ",math.cos(0*n))
print("cos(45) : ",math.cos(45*n))
print("cos(60) : ",math.cos(60*n))
print("cos(10) : ",math.cos(10*n))


output-

cos(90) : 6.123233995736766e-17
cos(0) : 1.0
cos(45) : 0.7071067811865476
cos(60) : 0.5000000000000001
cos(10) : 0.984807753012208




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!