Ask Your Question
1

Animation doesn't work

asked 8 years ago

cybervigilante gravatar image

updated 8 years ago

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)
Preview: (hide)

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 ( 8 years ago )

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 ( 8 years ago )

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 ( 8 years ago )

@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 ( 8 years ago )

@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 ( 8 years ago )

2 Answers

Sort by » oldest newest most voted
1

answered 7 years ago

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.

Preview: (hide)
link

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 ( 7 years ago )
0

answered 8 years ago

cybervigilante gravatar image

updated 8 years ago

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

Preview: (hide)
link

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 ( 8 years ago )
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 ( 8 years ago )

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 ( 8 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: 8 years ago

Seen: 1,455 times

Last updated: Apr 28 '17