All published worksheets from http://sagenb.org
Image: ubuntu2004
This worksheet is based on the description in Wikipedia on the Crank-Nicolson Method.
File: /usr/local/lib/sage/sage-4.7.2/local/lib/python2.6/site-packages/sage/plot/animate.py
Type: <type ‘type’>
Definition: animate( [noargspec] )
Docstring:
Return an animation of a sequence of plots of objects.
INPUT:
- v - list of Sage objects. These should preferably be graphics objects, but if they aren’t then plot is called on them.
- xmin, xmax, ymin, ymax - the ranges of the x and y axes.
- **kwds - all additional inputs are passed onto the rendering command. E.g., use figsize to adjust the resolution and aspect ratio.
EXAMPLES:
sage: a = animate([sin(x + float(k)) for k in srange(0,2*pi,0.3)], ... xmin=0, xmax=2*pi, figsize=[2,1]) sage: a Animation with 21 frames sage: a[:5] Animation with 5 frames sage: a.show() # optional -- ImageMagick sage: a[:5].show() # optional -- ImageMagickThe show function takes arguments to specify the delay between frames (measured in hundredths of a second, default value 20) and the number of iterations (default value 0, which means to iterate forever). To iterate 4 times with half a second between each frame:
sage: a.show(delay=50, iterations=4) # optional -- ImageMagickAn animation of drawing a parabola:
sage: step = 0.1 sage: L = Graphics() sage: v = [] sage: for i in srange(0,1,step): ... L += line([(i,i^2),(i+step,(i+step)^2)], rgbcolor=(1,0,0), thickness=2) ... v.append(L) sage: a = animate(v, xmin=0, ymin=0) sage: a.show() # optional -- ImageMagick sage: show(L)TESTS: This illustrates that ticket #2066 is fixed (setting axes ranges when an endpoint is 0):
sage: animate([plot(sin, -1,1)], xmin=0, ymin=0)._Animation__kwds['xmin'] 0We check that Trac #7981 is fixed:
sage: a = animate([plot(sin(x + float(k)), (0, 2*pi), ymin=-5, ymax=5) ... for k in srange(0,2*pi,0.3)]) sage: a.show() # optional -- ImageMagick