Home > database >  Animation in wxmaxima
Animation in wxmaxima

Time:12-31

How can I implement animation in wxmaxima? Suppose I have a function f(x) = x^a and I want to plot a graph in the form of a gif animation with a variable parameter a. The documentation says:

draw(
delay     = 100,
file_name = "zzz",
terminal  = 'animated_gif,
gr2d(explicit(x^2,x,-1,1)),
gr2d(explicit(x^3,x,-1,1)),
gr2d(explicit(x^4,x,-1,1)));

there will be three frames with a delay of 1 second (100 delay = 1 sec). In Maxima, you can use the 'for' loop. How to insert the for loop correctly into the draw() environment so that the number of frames can be adjusted by the cycle counter and the function being drawn depends on the counter?

CodePudding user response:

I don't think draw recognizes for loops. Try building up the list of frames via map and/or makelist. Append any additional arguments to the list of frames, and then say apply('draw, mylist). Something like:

myfunctions: makelist (x^i, i, 1, n);
myframes: map (lambda ([e], gr2d (explicit (e, x, -1, 1))), myfunctions);
mylist: append ([delay = 100, file_name = "zzz", terminal = 'animated_gif], myframes);
apply ('draw, mylist);

where n is the number of frames you want.

  • Related