-
-
Notifications
You must be signed in to change notification settings - Fork 132
/
trig.py
45 lines (28 loc) · 941 Bytes
/
trig.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import numpy as _onp
from numpy import pi as _pi
_deg2rad = 180.0 / _pi
_rad2deg = _pi / 180.0
def degrees(x):
"""Converts an input x from radians to degrees"""
return x * _deg2rad
def radians(x):
"""Converts an input x from degrees to radians"""
return x * _rad2deg
def sind(x):
"""Returns the sin of an angle x, given in degrees"""
return _onp.sin(radians(x))
def cosd(x):
"""Returns the cos of an angle x, given in degrees"""
return _onp.cos(radians(x))
def tand(x):
"""Returns the tangent of an angle x, given in degrees"""
return _onp.tan(radians(x))
def arcsind(x):
"""Returns the arcsin of an x, in degrees"""
return degrees(_onp.arcsin(x))
def arccosd(x):
"""Returns the arccos of an x, in degrees"""
return degrees(_onp.arccos(x))
def arctan2d(y, x):
"""Returns the angle associated with arctan(y, x), in degrees"""
return degrees(_onp.arctan2(y, x))