RM SH RM SH - 3 months ago 17
Python Question

Why does cos(x) give me a result of x as x was in radians?

I am using Python but there is something strange. Why does cos(x) give me a result of x as was in radians? while cos(radians(x)) gives the answer as x was in degree

for example :

>>> cos(75)
0.9217512697247493


but the truth is if 75 is in degree, then cos(75) = 0.26

>>> cos(radians(75))
0.25881904510252074


but the truth is if 75 is in radians, then cos(75) = 0.90

I am wrong ? why is that happening ?

Answer
  • cos(75) means "the cosine of 75 radians". (See documentation.)
  • radians(75) means "convert 75° to radians", i.e. "the number of radians that's equivalent to 75°". (See documentation.)
  • so cos(radians(75)) means "the cosine of {the number of radians that's equivalent to 75°} radians", i.e. "the cosine of 75°".
Comments