5.5. Trigonometry#

In addition to arithmetical operators, NumPy provides lots of essential functions and constants to perform trigonometrical operations:

In all trigonometric functions, angles are in radians by default. You can either convert to/from degrees by multiplying or dividing by \(\pi/180\) manually, or use np.deg2rad and np.rad2deg.

import numpy as np
import matplotlib.pyplot as plt

angle = np.linspace(0, 2 * np.pi, 100)

plt.plot(angle, np.sin(angle));