def cos(angle): return cosr(radians(angle))
from math import sqrt, sin as sinr, cos as cosr, atan as atanr, radians, degrees sin = lambda x: sinr(radians(x)) cos = lambda x: cosr(radians(x)) atan = lambda x: degrees(atanr(x)) def from_polar(size, angle): return [sin(angle) * size, cos(angle) * size] def to_polar(a): return {"size": size(a), "angle": angle(a)} def size(a): return sqrt(sum(val**2 for val in a)) def angle(a): return 90 if a[1] == 0 else atan(a[0] / a[1]) def _vectorise_binary(func): def new_func(a, b): try: return [func(val_a, val_b) for val_a, val_b in zip(a, b)] except TypeError: return [func(val, b) for val in a] return new_func
def cos(a): return cosr(rad(a))