Ask Your Question
0

Weird plot of a constant vector field with cylindrical coordinates

asked 2025-01-16 18:27:48 +0200

updated 2025-02-06 10:21:22 +0200

FrédéricC gravatar image

I just started using sagemath for some visualizations with vector fields and I stumbled upon some behaviour I cannot explain myself. I hope this is the correct place to ask this.

E.<rh,ph,z> = EuclideanSpace(coordinates='cylindrical')
r = E.vector_field(1, 0.01, 0, name='r')
r.plot()

I'm creating a field with constant vectors, which to my mathematical understanding should all look the same, the plot however looks rather different. (I cannot upload a picture as I'm new here)

Increasing the angle phi just a bit more leads to insanely large vectors in the first row in the plot. And the plot getting umanagable and also incorrect. Is this a bug or did I do something incorrectly?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2025-01-20 10:21:35 +0200

eric_g gravatar image

updated 2025-01-20 10:22:39 +0200

This is because when you write r.plot(), the plot is performed in terms of the default chart on E, which is that of cylindrical coordinates in your case. Accordingly, the axes of the plot are $\partial/\partial \rho$, $\partial/\partial\phi$ and $\partial/\partial z$. I guess you'd rather want the plot to be performed in a Cartesian frame instead, with the axes $\partial/\partial x$, $\partial/\partial y$ and $\partial/\partial z$. You should then specify it by means of the keyword argument chart:

r.plot(chart=E.cartesian_coordinates())

For a better sampling, you may use

r.plot(chart=E.cartesian_coordinates(), number_values=7)
edit flag offensive delete link more

Comments

After scouring the wiki a little bit more I at least found what you are talking about, but I couldn't get it to properly work. I'm now super confused about atlases, Riemann manifolds, charts and the like.

I think I'm lacking some very fundamental knowledge about topology, which I didn't think I'd need here, so I give up.

Sorry to anyone finding this thread later on, maybe eric's solution works for you.

I still thank you for trying to help. It seems to be a me problem not a sagemath problem

MrMugame gravatar imageMrMugame ( 2025-01-30 01:58:42 +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

Stats

Asked: 2025-01-16 18:27:48 +0200

Seen: 644 times

Last updated: Jan 30