Items tagged with blog blog Tagged Items Feed

A small piece of code for fun before the weekend, inspired by some recent posts:

http://www.johndcook.com/blog/2015/06/03/mystery-curve/

http://mathlesstraveled.com/2015/06/04/random-cyclic-curves-5/

http://www.walkingrandomly.com/?p=5677

 

cycler := proc(t, k, p, m, n, T) local expr, u, v;
  u := exp(k*I*t);
  expr := exp(I*t) * (1 - u/m + I*(u^(-p))/n);
  v := 1 + abs(1/n) + abs(1/m);
  plots:-complexplot( expr, t = 0 .. T, axes = none,
                      view = [-v .. v, -v .. v] );
end proc:

cycler(t, 5, 3, 2, 3, 2*Pi);

And that can be made into a small application (needs Maple 18 or 2015),

Explore( cycler(t, k, p, m, n, T),
         parameters = [ k = -10 .. 10, p = -10 .. 10,
                        m = -10.0 .. 10.0, n = -10.0 .. 10.0,
                        [ T = 0 .. 2*Pi, animate ] ],
         initialvalues = [ k = 5, p = 3, m = 2, n = 3, T = 2*Pi ],
         placement = left, animate = false, numframes = 100 );

cyclerapp.mw

The animation of parameter T from 0 to 2*Pi can also be fun if the view option is removed/disabled in the call to complexplot. (That could even be made a choice, by adding an additional argument for calling procedure cycler and an accompanying checkbox parameter on the exploration.)

acer

Page 1 of 1