Trigonometry

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));
_images/c9838f1e4db61d89f2e40e7866062b3cea2c9c8be2fcc6f4c039bc7204c2de74.png