Trigonometry

5.5. Trigonometry#

In addition to arithmetic 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));
_images/86ae6521920804f31ff59f6c79a5818fc3d0f2622f3d6343968de59879f856a8.png