# Vector Field example fails The following example fails with an error message in the last line.

This is an example taken from the "manifold.pdf" reference file, Page 337

I'm using SageMath 8.1 on Windows Native.

sage: S2 = Manifold(2, 'S^2')
sage: U = S2.open_subset('U') # the open set covered by spherical coord.
sage: XS.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi')
sage: R3 = Manifold(3, 'R^3')
sage: X3.<x,y,z> = R3.chart()
sage: F = S2.diff_map(R3, {(XS, X3): [sin(th)*cos(ph),sin(th)*sin(ph), cos(th)]}, name='F')
sage: F.display() # the standard embedding of S^2 into R^3
sage: v = XS.frame() ; v  # the coordinate vector d/dphi
sage: graph_v = v.plot(chart=X3, mapping=F, label_axes=False)
sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)
sage: graph_v + graph_S2


Moreover, each individual plot does not generate an error, but I don't see any plot, just an empty space!

edit retag close merge delete

Sort by » oldest newest most voted

I could see the sphere from all angles in jmol, decorated with some big blue arrows...

sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'


And also

sage: g = graph_v + graph_S2    # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object


could open in the firefox browser a representation, where one can change the view angle.

Make sure, the sage version is the last one.

Note: Tachyon could not do the job on my machine.

Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!

more

Hi Dan,

I have the same version of SageMath as you have.

The error I get after "graph_v + graph_S2", at the end of a long TraceBack, is:

error: Error -3 while decompressing: invalid distance too far back


How do I change to jmol ortachyion?

Thanks.

Actually the Jmol interface is somewhat buggy and it happens that graphic sums, such as graph_v + graph_S2 are not rendered on some machines. As for @dan_fulea, your example works on my machine, but I am not surprised that it does not work for you (such failures have already been reported). Use threejs instead:

sage: show(graph_v + graph_S2, viewer='threejs')


It is faster and of better quality. Hopefully threejs will become the default 3D viewer in Sage.

@dan_fulea: sage: show(graph_v + graph_S2, viewer='tachyon') works for me; what error do you get?

@dan_fulea: if you like vector field plots, you can see more of them here for $S^2$ and here for $S^3$ ;-) All are rendered with threejs.

using

show(graph_v + graph_S2, viewer='threejs')


I get no error but no plot