Ask Your Question
1

Tachyon in SageMathCloud

asked 10 years ago

David Roberts gravatar image

I'm new to Sage and only beginner experience in python, so there may be something obvious I'm missing.

I'm trying to create, initially, some plots using Tachyon in SMC. I cut and pasted Niles Johnson's code at this question, namely

sage: f = lambda t: (t,t^2,t^3)
sage: t = Tachyon(camera_center=(5,0,4))
sage: t.texture('t')
sage: t.light((-20,-20,40), 0.2, (1,1,1))
sage: t.parametric_plot(f,-5,5,'t',min_depth=6)
sage: t.show(verbose=True)

and I get the following error

tachyon /projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sage/temp/compute2dc1/22136/tmp_Iy4Cih.dat  -format PNG  -o /projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sage/temp/compute2dc1/22136/tmp_weeBQD.png   ; rm -f "/projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sage/temp/compute2dc1/22136/tmp_Iy4Cih.dat"
Error in lines 6-6
Traceback (most recent call last):
  File "/projects/6e9b9fc6-5d3c-4c2a-a57f-b5fe78a365fd/.sagemathcloud/sage_server.py", line 864, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "/usr/local/sage/sage-6.3.beta6/local/lib/python2.7/site-packages/sage/plot/plot3d/tachyon.py", line 339, in show
    os.system('%s %s 2>/dev/null 1>/dev/null &'%(sage.misc.viewer.png_viewer(), filename))
NameError: global name 'sage' is not defined

What should I do? It doesn't seem related to anything in the code used.

Preview: (hide)

Comments

It works on a classical (local) installation, so the pb might come from the cloud.

tmonteil gravatar imagetmonteil ( 10 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 10 years ago

William Stein gravatar image

You're hitting a bug in sage-6.3 (the bug has nothing to do with SageMathCloud). It's evidently fixed in sage-6.4, but even then, I don't think that way of viewing a tachyon plot would work in SMC. In any case, here's how to do this in SMC, which works now:

f = lambda t: (t,t^2,t^3)
t = Tachyon(camera_center=(5,0,4))
t.texture('t')
t.light((-20,-20,40), 0.2, (1,1,1))
t.parametric_plot(f,-5,5,'t',min_depth=6)
t.save('a.png')
salvus.file('a.png')

Here's a worksheet illustrating make the 3d plot you want to make, using the regular interactive 3d viewer and also tachyon:

https://cloud.sagemath.com/projects/4...

Preview: (hide)
link

Comments

I'd upvote, but I've not got the required karma. Virtual +1 from me, then.

David Roberts gravatar imageDavid Roberts ( 10 years ago )

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: 10 years ago

Seen: 1,220 times

Last updated: Nov 03 '14