Interactive apps

Python playground

Write and run Python with NumPy and Matplotlib, right in the browser.

In the book: Chapter 2: Review of vector calculus

import numpy as np
import matplotlib.pyplot as plt
#
# NumPy and Matplotlib are already available.
# Edit this code and press Run (or Ctrl/Cmd+Enter).
#
x, y = np.meshgrid(np.linspace(-2, 2, 15), np.linspace(-2, 2, 15))
u, v = -y, x  # solid-body rotation

fig, ax = plt.subplots(figsize=(5, 5))
ax.quiver(x, y, u, v)
ax.set_aspect("equal")
ax.set_title("u = (-y, x)")
plt.show()