Programming-how to find the angle

anglecomputer sciencepythontrigonometry

I want to write a function in python that has as two arguments, the sine and the cosine of an angle and it returns the angle. Which formula do we use to calculate the angle knowing the sine and the cosine? If we could just use the inverse trigonometric functions we wouldn't have to define two arguments for the function. I don't have an idea how we can calculate the angle. Can you help please?

Best Answer

math.atan2(c, s)

will produce the angle, where $c$ is the known cosine and $s$ is the known sine. The value produced will lie between $-\pi$ and $\pi$; if you want it to be between $-180$ degrees and $180$ degrees, use

math.atan2(c, s) * 180.0/math.pi