# Unscaled arrows in a vector field

I have a vector field I'm plotting, but the arrows are scaled so small near the singular points, it's unclear which are sinks, sources, and saddles. Is there a way to change the arrow scaling so they are all the same length and the behavior is clearer?

x,y = var('x,y')
VF = plot_vector_field(((x^2-1)*(y^2-1)*x*y, (x^2+(y-3/8)^2-1/64)*(x^2+(y+3/8)^2-1/64)), (x, -1,1), (y, -1,1))
points = point([(0,1/4),(0,1/2),(0,-1/4),(0,-1/2)],color='red', size=25)
VF + points

edit retag close merge delete

Sort by » oldest newest most voted

I did not find any rescaling option in the source code, but you can normalize your vector field as follows:

sage: f(x,y) = (x^2-1)*(y^2-1)*x*y
sage: g(x,y) = (x^2+(y-3/8)^2-1/64)*(x^2+(y+3/8)^2-1/64)
sage: plot_vector_field((f(x,y)/sqrt(f(x,y)^2+g(x,y)^2), g(x,y)/sqrt(f(x,y)^2+g(x,y)^2)), (x, -1,1), (y, -1,1))


Which indeed shows sinks, sources, and saddles much better than

sage: plot_vector_field((f(x,y),g(x,y)), (x, -1,1), (y, -1,1))


That said, it could be a good idea to add a normalize option to plot_vector_field(), hence i opened trac ticket 18641 to implement this.

more

Glad it worked. I am implementing the method for the Sage source code. If you know one, could you please give me a simple similar 3-dimensional example ? I will add it in the doc of the normalize option for plot_vector_field3d.