Animating curves question

1 view
Skip to first unread message

dean moore

unread,
Feb 5, 2008, 4:56:59 PM2/5/08
to sage-...@googlegroups.com
I've fiddled for some time, searched < http://www.sagemath.org/doc/html/ref/module-sage.plot.animate.html >, googled & tried
various code that didn't work.

What I'm trying to do is to code an animation from one point to the next, say, for example, to graph y = x^2 by drawing "short"
lines from (i, i^2) to (i+j, (i+j)^2)

I've tried obvious code like

  step = 0.1
  a = animate([line((i,i),(i+step,i+step), rgbcolor=(1,0,0)) for i in srange(0, 1, step)])
  a.show()

I get a graph with no line.  Is there a way to animate the production of a curve?

Thanks!

Dean

William Stein

unread,
Feb 5, 2008, 6:07:47 PM2/5/08
to sage-...@googlegroups.com

Yes. Please see

https://www.sagenb.org/home/pub/1674/

The code is

step = 0.1
L = Graphics()
v = []
for i in srange(0,1,step):
L += line([(i,i^2),(i+step,(i+step)^2)], rgbcolor=(1,0,0), thickness=2)
L.xmin(0); L.ymin(0)
v.append(L)

a = animate(v)
a.show()

----

By the way, that I have to give the xmin, ymin in the loop instead of writing
a = animate(v, xmin=0, ymin=0) is a bug. I just looked into it and fixed it:
http://trac.sagemath.org/sage_trac/ticket/2066

William

Ted Kosan

unread,
Feb 6, 2008, 12:30:39 AM2/6/08
to sage-...@googlegroups.com
William wrote:

> Yes. Please see
>
> https://www.sagenb.org/home/pub/1674/
>
> The code is
>
> step = 0.1
> L = Graphics()
> v = []
> for i in srange(0,1,step):
> L += line([(i,i^2),(i+step,(i+step)^2)], rgbcolor=(1,0,0), thickness=2)
> L.xmin(0); L.ymin(0)
> v.append(L)
>
> a = animate(v)
> a.show()

When I execute this code in the notebook ('SAGE Version 2.10, Release
Date: 2008-01-18'), I receive the following error:

sh: convert: command not found

Ted

William Stein

unread,
Feb 6, 2008, 2:29:34 AM2/6/08
to sage-...@googlegroups.com
The animate command currently *requires* that you have the convert
command in your path. Convert is part of ImageMagick, and is not in
any way a part of sage.

In the future animate might be changed to use png's and javascript
instead of animated gif's.

- William

(Sent from my iPhone.)

Timothy Clemans

unread,
Feb 7, 2008, 12:05:44 AM2/7/08
to sage-newbie
I think that there should always be the option to make animated gifs.

On Feb 5, 11:29 pm, William Stein <wst...@gmail.com> wrote:
> The animate command currently *requires* that you have the convert
> command in your path. Convert is part of ImageMagick, and is not in
> any way a part of sage.
>
> In the future animate might be changed to use png's and javascript
> instead of animated gif's.
>
> - William
>
> (Sent from my iPhone.)
>
Reply all
Reply to author
Forward
0 new messages