Ask Your Question

Unscaled arrows in a vector field

asked 2015-06-08 19:36:17 +0200

jford1906 gravatar image

updated 2015-06-08 21:46:53 +0200

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-06-08 23:28:57 +0200

tmonteil gravatar image

updated 2015-06-08 23:57:22 +0200

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.

edit flag offensive delete link more


That's working, thanks!

jford1906 gravatar imagejford1906 ( 2015-06-09 00:11:40 +0200 )edit

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.

tmonteil gravatar imagetmonteil ( 2015-06-09 16:32:21 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-06-08 19:36:17 +0200

Seen: 684 times

Last updated: Jun 08 '15