39import matplotlib.pyplot
as plt
40from pylab
import meshgrid, arange, quiver, quiverkey, sqrt
44def makeVectorField(f, xmin, xmax, ymin, ymax, step):
45 X, Y = meshgrid(arange(xmin, xmax, step), arange(ymin, ymax, step))
46 U, V = zip(*map(
lambda xx: f(*xx), zip(X, Y)))
47 Q = quiver(X, Y, U, V, units=
"width")
48 quiverkey(Q, 0, 0, 4,
"", coordinates=
"figure", labelpos=
"W")
52ax = fig.gca(aspect=
"equal")
53x = np.loadtxt(
"vfrrt-nonconservative.path")
55 lambda x, y: (y / sqrt(x * x + y * y + 1e-6), -x / sqrt(x * x + y * y + 1e-6)),
62ax.plot(x[:, 0], x[:, 1])