Ask Your Question
1

Vector Field example fails

asked 2018-01-19 18:02:38 +0200

danielvolinski gravatar image

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()[1] ; 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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-01-19 19:31:00 +0200

dan_fulea gravatar image

updated 2018-01-20 03:19:21 +0200

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!

edit flag offensive delete link more

Comments

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.

danielvolinski gravatar imagedanielvolinski ( 2018-01-19 20:38:59 +0200 )edit

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.

eric_g gravatar imageeric_g ( 2018-01-19 22:39:41 +0200 )edit

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

eric_g gravatar imageeric_g ( 2018-01-19 22:41:51 +0200 )edit

@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.

eric_g gravatar imageeric_g ( 2018-01-19 22:47:22 +0200 )edit

using

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

I get no error but no plot

danielvolinski gravatar imagedanielvolinski ( 2018-01-20 00:12:11 +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: 2018-01-19 18:02:38 +0200

Seen: 389 times

Last updated: Jan 20 '18