In [2]:
import numpy as np
points = np.arange(-5, 5, 0.01) # 1000 equally spaced points
In [3]:
xs, ys = np.meshgrid(points, points)
ys
Out[3]:
In [4]:
z = np.sqrt(xs ** 2 + ys ** 2)
z
Out[4]:
In [5]:
import matplotlib.pyplot as plt
plt.imshow(z, cmap=plt.cm.gray); plt.colorbar
plt.title("Image plot of $\sqrt{x^2 + y^2}$ for a grid of values")
Out[5]:
In [9]:
Out[9]:
In [ ]: