Ask Your Question
1

3D Vector Field Doesn't have Arrows

asked 2018-04-07 04:01:14 +0100

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 21:09:34 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
5

answered 2018-04-07 13:25:06 +0100

eric_g gravatar image

updated 2018-04-08 10:38:38 +0100

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 12:21:16 +0100 )edit
2

answered 2018-04-07 11:40:03 +0100

slelievre gravatar image

updated 2018-04-07 12:49:30 +0100

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-07 04:01:14 +0100

Seen: 768 times

Last updated: Apr 08 '18