First time here? Check out the FAQ!

Ask Your Question
1

Unscaled arrows in a vector field

asked 9 years ago

jford1906 gravatar image

updated 9 years ago

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
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 9 years ago

tmonteil gravatar image

updated 9 years ago

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.

Preview: (hide)
link

Comments

That's working, thanks!

jford1906 gravatar imagejford1906 ( 9 years ago )

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 ( 9 years ago )

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: 9 years ago

Seen: 817 times

Last updated: Jun 08 '15