ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 21 Jan 2018 06:22:45 -0600Vector Field example failshttp://ask.sagemath.org/question/40693/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()[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!
Fri, 19 Jan 2018 11:02:38 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/Answer by dan_fulea for <p>The following example fails with an error message in the last line.</p>
<p>This is an example taken from the "manifold.pdf" reference file, Page 337</p>
<p>I'm using SageMath 8.1 on Windows Native.</p>
<pre><code>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
</code></pre>
<p>Moreover, each individual plot does not generate an error, but I don't see any plot, just an empty space!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?answer=40695#post-id-40695I 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!Fri, 19 Jan 2018 12:31:00 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?answer=40695#post-id-40695Comment by danielvolinski for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40726#post-id-40726Hi Eric,
I use a Jupyter notebook. If the command is:
show(graph_v + graph_S2, viewer='threejs')
I get only a large space below the cell, as a place holder for the plot, but nothing on it.
If the command is:
show(graph_v + graph_S2, viewer='tachyon')
The plot is OK.
DanielSun, 21 Jan 2018 06:22:45 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40726#post-id-40726Comment by eric_g for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40712#post-id-40712@danielvolinski: if you run `show(graph_v + graph_S2, viewer='threejs')` from the Sage console, it should open your default web browser and render the plot in it. If you run it from a Jupyter notebook, then the plot should appear directly in the notebook.Sat, 20 Jan 2018 05:00:54 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40712#post-id-40712Comment by danielvolinski for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40704#post-id-40704using
show(graph_v + graph_S2, viewer='tachyon')
I get the plot!Fri, 19 Jan 2018 17:15:20 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40704#post-id-40704Comment by danielvolinski for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40703#post-id-40703using
show(graph_v + graph_S2, viewer='threejs')
I get no error but no plotFri, 19 Jan 2018 17:12:11 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40703#post-id-40703Comment by eric_g for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40701#post-id-40701@dan_fulea: if you like vector field plots, you can see more of them [here for $S^2$](http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.1/SM_sphere_S2.ipynb) and [here for $S^3$](http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.1/SM_sphere_S3_vectors.ipynb) ;-) All are rendered with `threejs`.Fri, 19 Jan 2018 15:47:22 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40701#post-id-40701Comment by eric_g for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40700#post-id-40700@dan_fulea: `sage: show(graph_v + graph_S2, viewer='tachyon')` works for me; what error do you get?Fri, 19 Jan 2018 15:41:51 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40700#post-id-40700Comment by eric_g for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40699#post-id-40699Actually 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.Fri, 19 Jan 2018 15:39:41 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40699#post-id-40699Comment by danielvolinski for <p>I could see the sphere from all angles in <code>jmol</code>, decorated with some big blue arrows...</p>
<pre><code>sage: graph_v + graph_S2
Launched jmol viewer for Graphics3d Object
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'
</code></pre>
<p>And also</p>
<pre><code>sage: g = graph_v + graph_S2 # sorry, edited, did not copy this line...
sage: g.show( viewer='threejs' )
Launched html viewer for Graphics3d Object
</code></pre>
<p>could open in the firefox browser a representation, where one can change the view angle.</p>
<p>Make sure, the sage version is the last one.</p>
<p>Note: Tachyon could not do the job on my machine.</p>
<p>Note: I was really surprised to see the plots, here is really the best place to learn sage, the question gets 1up!</p>
http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40696#post-id-40696Hi 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 or `tachyion?
Thanks.Fri, 19 Jan 2018 13:38:59 -0600http://ask.sagemath.org/question/40693/vector-field-example-fails/?comment=40696#post-id-40696