Flashcards for Python lesson 1: Arrays and angles
Read the front, say the back to yourself, then open the card.
np.arange(a, b)
The numbers from a up to, but not including, b, as a numpy array.
Vectorised code
Arithmetic on whole arrays at once instead of a loop over items: shorter and faster.
Radians
The angle unit of np.cos and np.sin: 2π for a full turn. np.radians(144) converts from degrees.
Polar to x, y
x = r·cos θ, y = r·sin θ.
plt.scatter(x, y, c=values)
One dot per point; c colours each one by a value through the colour map cmap.