Skip to content

Instantly share code, notes, and snippets.

@kosugi
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save kosugi/9096199 to your computer and use it in GitHub Desktop.

Select an option

Save kosugi/9096199 to your computer and use it in GitHub Desktop.
from math import pi, sqrt, acos, asin, sin, cos
for n in range(0, 360+1, 10):
x = cos(pi * n / 180)
y = sin(pi * n / 180)
r = sqrt(x ** 2 + y ** 2)
th_cos = 180 * acos(x / r) / pi
th_sin = asin(y / r)
if th_sin < 0:
th_cos = 360 - th_cos
print('%3d: (%+.2f, %+.2f): %.2f' % (n, x, y, th_cos))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment