Ask Your Question
1

3D Vector Field Doesn't have Arrows

asked 2018-04-06 21:01:14 -0500

jackseven gravatar image

I have been trying to plot 3D vector fields, but I keep running into a problem. The graphic does not have arrows instead it is just lines. Here is the code.

var('x,y,z')
p = plot_vector_field3d((x,y,z), (x, -5, 5), (y, -5, 5), (z, -5, 5))
p.show()
edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2018-04-07 14:09:34 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
5

answered 2018-04-07 06:25:06 -0500

eric_g gravatar image

updated 2018-04-08 03:38:38 -0500

Until #24623 is ready, the minimal code to plot the proposed vector field within the manifold framework is (this works with Sage >= 7.5):

R3 = Manifold(3, 'R^3')
X.<x,y,z> = R3.chart()
v = R3.vector_field()
v[:] = (x,y,z)
p = v.plot(max_range=5, scale=0.5)
p.show()

It is a little bit slow, but thanks to some optimisations, this should be improved in future versions of Sage. See the online doc for the list of all options of v.plot(). Note also that you can replace the last line by p.show(viewer='threejs').

edit flag offensive delete link more

Comments

Once #24623 is merged in Sage, the above code will reduce to

E.<x,y,z> = EuclideanSpace(3)
v = E.vector_field((x,y,z))
v.plot(max_range=5, scale=0.5)
eric_g gravatar imageeric_g ( 2018-04-08 05:21:16 -0500 )edit
2

answered 2018-04-07 04:40:03 -0500

slelievre gravatar image

updated 2018-04-07 05:49:30 -0500

The SageManifolds implementation of vector fields gives you a rendering with arrows.

See the gallery at

There is ongoing work to make the SageManifolds approach the default for vector fields in Sage, see

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2018-04-06 21:01:14 -0500

Seen: 50 times

Last updated: Apr 08