In [1]:
def PlotQuiver(f,xLims=[-5,5],yLims=[-5,5],density=20, args=()):
x = np.linspace(xLims[0], xLims[1], density)
y = np.linspace(yLims[0], yLims[1], density)
xs=[]
ys=[]
us=[]
vs=[]
for xx in x:
for yy in y:
sol=f((xx,yy),0,*args)
u,v=np.hsplit(sol,2)
xs.append(xx)
ys.append(yy)
us.append(u)
vs.append(v)
plt.quiver(xs,ys,us,vs)
In [ ]:
def IntersectionIndices(f,g):
return np.where(np.diff(np.sign(f-g)))[0]