Ask Your Question
1

Animation doesn't work

asked 2017-04-07 04:26:38 +0100

cybervigilante gravatar image

updated 2017-04-07 18:25:50 +0100

FrédéricC gravatar image

I'm using a tutorial and should get an animation from this, but nada. All I get is the title: Animation with 20 frames, and nothing else. Is this correct or did the author miss something? I've waited ten minutes and my computer isn't That slow ;) Midrange Acer with four cores. Local server in a virtualbox on win 8. I also tried it in Firefox as well as Chrome. No change.

f(x) = 5*x - x^2/8 + x^3/1200
df(x) = diff(f(x),x)
max = 100
p = plot(f(x),x,0,max)
lblp = text("$y = " + latex(f(x)) + "$",[40,100],fontsize=14)
lbldp = text("$y' = " + latex(df(x)) + "$",[40,80],fontsize=14,rgbcolor='#006000')
ga = []
for argx in srange(0,max,5):
    dp = plot(f(argx) + (df(argx)*(x-argx)),x,0,max,color="#006000")
    xp = point((argx,f(argx)),rgbcolor='#800000')    
    ga.append(p+lblp+lbldp+dp+xp)
animate(ga,ymin=0,ymax=max,axes_labels=['x','y'],fontsize=12,figsize=(4,3)).show(delay=1)
edit retag flag offensive close merge delete

Comments

I found you had to install ImageMagick (not mentioned in the tutorial - the usual dependency search ;), but still nothing is happening. FFMPEG is already installed.

cybervigilante gravatar imagecybervigilante ( 2017-04-07 04:57:55 +0100 )edit

It appears I have to install ImageMagick into the Virtualbox, since it won't pick it up from Windows, but I can't find how to do that yet or if it's even possible in Windows. Looks like it might work in linux, though. But then I wouldn't need a virtualbox ;)

cybervigilante gravatar imagecybervigilante ( 2017-04-07 05:04:21 +0100 )edit

true, animate doesn't seem to work in the jupyter notebook (launch via sage -n jupyter) as of v7.6. however, it does work in the sage notebook (launch via sage -n), and it also works in the command line (launch via sage), this time producing a set of .pdf files. let me mention in passing that you can use sagemath online via sagemathcell (animate works there too) and for more serious purposes check sagemathcloud.

mforets gravatar imagemforets ( 2017-04-07 06:37:23 +0100 )edit

@mforets - did you open a bug report for animate not working in the Jupyter? If this starts to be our default then it needs to support things like this.

kcrisman gravatar imagekcrisman ( 2017-04-07 12:27:34 +0100 )edit

@cybervigilante - to be fair, in a huge warning at the top of http://doc.sagemath.org/html/en/refer... it says you need one of those two tools. The tutorials are not intended, nor could be, comprehensive. If you point out exactly where it didn't say anything about it, that would be helpful so that we can point that documentation to the warning as well, thank you.

kcrisman gravatar imagekcrisman ( 2017-04-07 12:28:43 +0100 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2017-04-28 17:38:04 +0100

pang gravatar image

This code will display the animation embeded in a jupyter notebook

my_path = 'my.gif'
a.gif(savefile=my_path)
html('<img src="%s" />'%my_path)

Warning: this saves the animation in the same folder where the notebook is.

edit flag offensive delete link more

Comments

Re: warning - I suppose unless you made my_path equal to /path/to/somewhere/else/my.gif? (If permissions all worked cleanly.)

kcrisman gravatar imagekcrisman ( 2017-04-28 21:54:27 +0100 )edit
0

answered 2017-04-07 15:20:48 +0100

cybervigilante gravatar image

updated 2017-04-07 15:23:10 +0100

@mforets Animate works in sagemathcell but not sagemathcloud for me. Although I can do manual animation in cloud it breaks up due to bandwidth, so I guess sagemathcell is the best to use for a tutorial. Although the right-click dropdown doesn't work in either. But that's all icing on the cake. I can see where animation would be good in examining a dynamical system, but I'm far from having the processor speed for that anyway. Tks for the tip about sagemathcell - it's much faster than sagemathcloud.

BTW, I'm vaguely familiar with bug tickets in python but where do I go to do one in Sage?

edit flag offensive delete link more

Comments

https://trac.sagemath.org but you'd have to sign up for an account as it is manually done to avoid spam issues.

kcrisman gravatar imagekcrisman ( 2017-04-07 20:33:11 +0100 )edit
1

in SMC, create a new file of type "Sage Worksheet". then this example produces an embedded window with the animation. but i had to modify the speed parameter to say delay=5 because with 1 it is super fast.

mforets gravatar imagemforets ( 2017-04-08 11:57:33 +0100 )edit

Tks for the tip about sagemathcell - it's much faster than sagemathcloud. >> from a personal experience, i agree about that, but if you go on with an upgrade then it's ok

mforets gravatar imagemforets ( 2017-04-08 15:18:05 +0100 )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: 2017-04-07 04:26:38 +0100

Seen: 1,374 times

Last updated: Apr 28 '17