Ask Your Question

# 3D Vector Field Doesn't have Arrows

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 close merge delete

## Comments

Welcome to Ask Sage! Thank you for your question!

( 2018-04-07 21:09:34 +0200 )edit

## 2 Answers

Sort by ยป oldest newest most voted

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').

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)
( 2018-04-08 12:21:16 +0200 )edit

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

more

## Your Answer

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

Add Answer

## Stats

Asked: 2018-04-07 04:01:14 +0200

Seen: 696 times

Last updated: Apr 08 '18