Ask Your Question
1

Unscaled arrows in a vector field

asked 2015-06-08 12:36:17 -0500

jford1906 gravatar image

updated 2015-06-08 14:46:53 -0500

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
1

answered 2015-06-08 16:28:57 -0500

tmonteil gravatar image

updated 2015-06-08 16:57:22 -0500

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

Comments

That's working, thanks!

jford1906 gravatar imagejford1906 ( 2015-06-08 17:11:40 -0500 )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 09:32:21 -0500 )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

Stats

Asked: 2015-06-08 12:36:17 -0500

Seen: 134 times

Last updated: Jun 08 '15