## Precomputing data for animation...

I'm trying to make 3D-animation and the procedure takes an enormous amount of time to make frames for it. It took over 10 minutes to create animation consisting of 50 frames (over t=0..1000). If I increase the number of frames or range of time, it just wouldn't reach the end of calculation (keeps evaluating till I lose patience or my faith in Maple)

Is there a way to somehow precompute data for animation (maybe store it somewhere) so that it could gather it from there and the animation construction itself would be faster?

Here's the code: ClassicalTrajectoriesH2X_harm.mw (animation is in the end of the file)

P.S. I have Asus X555LJ; Intel Core i5-5200U, 2.2GHz; 12Gb RAM, for the last few months it presented itself as a rather fast piece of machinery.

## Multiple animation windows...

Is it possible to create several animation windows and run them simultaneously?

I'm feeling that the answer to this question will be no, so I explain my problem. I have an animation of rotating object and I have some quantity that relates to the rotation. I want to see the rotation of object and the propagation of the graph of the quantity simultaneously. Maybe there is a way to somehow split the plot window in two, so in the left would be the rotation animation, and in the right would be the function animation.

## Procedures for two animations

by: Maple 2016

We assume that the radius of the outer stationary circle is  1. If we set the radius  x  of the inner stationary circle, all the other circles are uniquely determined by solving the system Sys.  Should be  x<=1/3 . If  x=1/3  then all the inner circles have a radius  1/3 . The following picture explains the meaning of symbols in the procedure Circles:

Circles:=proc(x)

local OO, O1, O2, O3, O4, O2x, O2y, O3x, O3y, OT, T1, T2, T3, s, t, dist, Sys, Sol, sol, y, u, v, z, C0, R0, P;

uses plottools, plots;

OO:=[0,0]: O1:=[x+y,0]: O2:=[O2x,O2y]: O3:=[O3x,O3y]: O4:=[-x-z,0]: OT:=[x+2*y-1,0]:

T1:=(O2*~y+O1*~u)/~(y+u): T2:=(O3*~u+O2*~v)/~(u+v): T3:=(O4*~v+O3*~z)/~(v+z):

solve({(T2-T1)[1]*(s-((T1+T2)/2)[1])+(T2-T1)[2]*(t-((T1+T2)/2)[2])=0, (T3-T2)[1]*(s-((T2+T3)/2)[1])+(T3-T2)[2]*(t-((T3+T2)/2)[2])=0}, {s,t}):

assign(%);

dist:=(A,B)->sqrt((B[1]-A[1])^2+(B[2]-A[2])^2):

Sys:={dist(O1,O2)^2=(y+u)^2, dist(OO,O2)^2=(x+u)^2, dist(O2,O3)^2=(u+v)^2, dist(OO,O3)^2=(x+v)^2, dist(O3,O4)^2=(z+v)^2, x+y+z=1, dist(O2,OT)^2=(1-u)^2, dist(O3,OT)^2=(1-v)^2};

Sol:=op~([allvalues([solve(Sys)])]);

sol:=select(i->is(eval(convert([y>0,u>0,v>0,z>0,O2y>0,x<=y,u<=y,v<=u,z<=v],`and`),i)), Sol)[];

assign(sol);

O1:=[x+y,0]: O2:=[O2x,O2y]: O3:=[O3x,O3y]: O4:=[-x-z,0]: OT:=[x+2*y-1,0]:

C0:=eval([s,t],sol);

R0:=eval(dist(T1,C0),sol):

P:=proc(phi)

local eq, r1, r, R, Ot, El, i, S, s, t, P1, P2;

uses plots,plottools;

eq:=1-dist([r*cos(s),r*sin(s)],OT)=r-x;

r1:=solve(eq,r);

r:=eval(r1,s=phi);

R[1]:=evalf(r-x);

Ot[1]:=evalf([r*cos(phi),r*sin(phi)]);

El:=plot([r1*cos(s),r1*sin(s),s=0..2*Pi],color="Green",thickness=3);

for i from 2 to 6 do

S:=[solve({1-dist(OT,[s,t])=dist(Ot[i-1],[s,t])-R[i-1], 1-dist(OT,[s,t])=dist(OO,[s,t])-x})];

P1:=eval([s,t],S[1]); P2:=eval([s,t],S[2]);

Ot[i]:=`if`(evalf(Ot[i-1][1]*P1[2]-Ot[i-1][2]*P1[1])>0,P1,P2);

R[i]:=dist(Ot[i],OO)-x;

od;

display(El,seq(disk(Ot[k],0.012),k=1..6),circle(C0,R0,color=gold,thickness=3),circle([x+2*y-1,0],1, color=blue,thickness=4), circle(OO,x, color=red,thickness=4), seq(circle(Ot[k],R[k], thickness=3),k=1..6), scaling=constrained, axes=none);

end proc:

animate(P,[phi], phi=0..Pi, frames=120);

end proc:

Example of use (I got  x=0.22  just by measuring the ruler displayed original animation):

Circles(0.22);

The curve on the following animation is an astroid (a special case of hypocycloid). See wiki for details. Hypocycloid procedure creates animation for any hypocycloid.  Parameters of the procedure: R is the radius of the outer circle, r is the radius of the inner circle.

Hypocycloid:=proc(R,r)

local A, B, f, g, F;

uses plots,plottools;

A:=circle(R,color=green,thickness=4):

B:=display(circle([R-r,0],r,color=red,thickness=4),line([R-r,0],[R,0],color=red,thickness=4)):

f:=t->plot([(R-r)*cos(s)+r*cos((R-r)/r*s),(R-r)*sin(s)-r*sin((R-r)/r*s),s=0..t],color=blue,thickness=4):

g:=t->rotate(rotate(B,-R/r*t,[R-r,0]),t):

F:=t->display(A,f(t),g(t),scaling=constrained):

animate(F,[t], t=0..2*Pi*denom(R/r), frames=90);

end proc:

Examples of use:

Hypocycloid(4,1);

Hypocycloid(5,3);

## how to get the coordinate of a swirl ...

http://mathforum.org/kb/message.jspa?messageID=685890

i find equation above

for ii from 0 by 5 to 365 do
eq1 := x^2 + y^2 = arccos(x/r);
eq2 := y = evalf((atan(-1) - ii*Pi/180)/Pi)*(-1.0)*x;
xy := fsolve({eq1, eq2});
print("M",rhs(xy[1]),rhs(xy[2]),","):
od:

but i do not understand how to set r

i use a line scanning 365 degrees to get the path of swirl

would like to get path data for c# WPF animation

but this method may have multiple solution because an intersection of swirl

and a line can have multiple points

## Attempt to create an animation zooming in on axis...

I want to apologize if this being neither necessarily a minimal working example for one question nor just one question is uncomfortable. The "MWE" was created on and is designed for Linux machines including ImageMagick. The problem itself should be obvious to all users though, as the subfolder and creation of the gif are just conveniences. I have three sections concerning the different problems occuring in my attempts.

(which I was told is not doable in maple ... hence the gif)

The goal was to create an animation that zooms in on a function. As maple just wouldn't allow scaling of axis in animations I decided to export single frames and then convert those with ImageMagick. Maple offers ssystem(„...“) which allows for command line usage.

The problem (may as well be a bug) occurs when I try to export images in a for loop with exportplot(...). If the path as well as previously exported images exist, it won't output an error but still not export the desired images. Exporting frames separately works just fine, as well as doing the very same operation in a separate for loop.

(see the first red comment and export section)

After using the workaround in a second for loop. I couldn't figure out how to import the images and then create an animation from them. The main obstacle is the fact that the imported pictures are put into plot-functions.

(see the second red comment)

 > restart;
 > with(plottools): f1 := s -> sin(2*s): max_frame := 10: # = number of steps for k from 0 to max_frame do     pic[k] := plot(f1(x), x=-Pi*(1-k/max_frame)..Pi*(1-k/max_frame),                     filled=true, #color = ["Orange"],                     color = ColorTools:-Color([0,                                               floor(128*k/max_frame),                                               floor(255*k/max_frame)                                               ]),                     view=[-Pi*(1-k/max_frame)..Pi*(1-k/max_frame), -1..1]                     ): end do: path := FileTools:-TemporaryDirectory(); path_list := ssystem("pwd"); path := path_list[2]; ssystem("mkdir ./pics"); # creates a subfolder path := FileTools:-JoinPath([path, "pics"]); # need to change path to subfolder plotsetup(window, plotoptions="width=480, height=600"); for k from 0 to max_frame do     file[k] := FileTools:-JoinPath([path,                                      MapleTA:-Builtin:-strcat("frame_",                                                               convert(k, string),                                                               ".jpg")                                     ]);     # exportplot(file[k], pic[k]); # does not work end do:
 > exportplot(file[0], pic[0]); # works
 > # ===================================================================================== # export # ===================================================================================== for k from 0 to max_frame do   exportplot(file[k], pic[k]); od; # also works
 > # ===================================================================================== # import # ===================================================================================== for k from 0 to max_frame do     reimported_pic[k] := importplot(file[k]); # this might take a while (depending on the amount of frames) end do: # import works but [Length of output exceeds limit of 1000000] whattype(reimported_pic[0]); #seems to create a plot function show := convert(reimported_pic,list): #Error, while processing result #There is no help page available for this error
 > show[1]; # works
 > # ===================================================================================== # create an animated gif at least # ===================================================================================== delay_time := ceil(evalf(100/max_frame)); command_for_gif := MapleTA:-Builtin:-strcat("convert -delay ",                                             convert(delay_time, string),                                             " -loop 0 ", # -reverse ",                                             FileTools:-JoinPath([path, "frame_*.jpg "]),                                             FileTools:-JoinPath([path, "animation.gif"])                                             ); ssystem(command_for_gif);
 >

I would be grateful for any suggestions. Moreover I have run accross

?DocumentTools:-Components:-VideoPlayer

which I could not figure out how to use by the help pages (I tried to create an avi and import that). If someone has informations on that, please share!

## animation plot of two GIFs...

how can i do this GIFs with maple ?

## Parallel curves on surfaces

by: Maple 15

Parallel curves on surfaces. The distance between the points of the curves is measured along the curves of intersection of the surface and perpendicular planes.
(According to tradition, it also does not make sense.)

equidistant_curve_surface_MP.mw

by: Maple 15

General description of the method of solving underdetermined systems of equations. As a particular application of the idea proposed a universal method  kinematic analysis for all kinds of linkage (lever) mechanisms. With the description and examples.

## How to know how long animation lasts ...

How to know how long the animation last and how to stop gif at the end.

I created a GIF from exporttool but I don't know how long is the animation ? I mean when it stops at the end of value. Or how to make GIF run as real time. because I make a gif for showing how a thing fall down from a attitude. And I need to show some figure like t (time) , h ( high ), v( speed ) thing like that while it falling down.

Thanks

## Whale with fountain

by: Maple

Dasayeva Diana, 6th form

кит_Аним_Диана.mws

## Problem with exportplot...

When I used exportplot in Maple2015 , the GIF file made easily after Enter. But when I use Engine.evaluate in Java jOpenMaple. it works for every command but exportplot. It didn't create any GIF file. I'm working on project must be use this for create animation by Maple but now that make big trouble. Any one to help this ?

VeHinhNemXien := proc(Alpha,Vbd)
local Y,V0,alpha,X,ball,Xmax,bgr;
with(plottools):
with(plots):
Y := unapply(V0*sin(alpha)*X/(V0*cos(alpha)) - 1/2*9.8*(X/(V0*cos(alpha)))^2,alpha,V0,X);
ball := proc(x,y) plots[pointplot]([[x,y]],color=red,symbol=solidcircle,symbolsize=40) end proc;
Xmax := 2*Vbd^2*sin(Alpha)*cos(Alpha)/9.8;
bgr := plot(Y(Alpha,Vbd,X),X=0..Xmax,linestyle=[2]);
animate(ball,[X,Y(Alpha,Vbd,X)],X=0..Xmax,scaling=constrained,labels=["Độ xa","Độ cao"],frames=60,background=bgr);
exportplot(FileTools:-JoinPath([FileTools:-TemporaryDirectory(), "dothi.gif"]), animate(ball,[X,Y(Alpha,Vbd,X)],X=0..Xmax,scaling=constrained,labels=["Độ xa","Độ cao"],frames=60,background=bgr), gif);
end proc:

save VeHinhNemXien , "D:\\VeHinhNemXien.m";

in java file

String a[];
a = new String[1];
a[0] = "java";
t = new Engine(a, new EngineCallBacksDefault(), null, null);

t.restart();

t.evaluate(....query to call VeHinhNemXien to draw plot).

I checked carefully. When call it on Maple, it created GIF, but not in java. I checked queryString carefully.

New Info. I find that when I t.evaluate(....query to call VeHinhNemXien to draw plot) . this code make java stop there. that mean no code after this line can run.

## Spherical wave reflected from cylinder...

Dear all,

I would like to find a way to make the reflection of a spherical wave inside a tube (a cylinder). You have herafter an exemple of a sphere increasing inside a tube, but without the reflections...

Any idea how to do this?

Thanks a lot for your help.

## How to replicate this Mma animation?...

I accidentally came across a nice Mma animation. Unfortunately, I am able to present only few frames of it in MaplePrimes. See two inconsecutive frames below

I find this animation very deep. I don't remember something similar. It looks like an iterative
map shown in its dynamics. Not being an expert in Mathematica, I don't understand the machinery of the generating code.
n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]
Here is its fragment translated into Maple:
>with(MmaTranslator):
>FromMma(" (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;");
map(unapply(_Z1/(0.1e-1+sqrt(_Z1 . _Z1)), _Z1), unapply(x(_Z1)-x, _Z1))
To my regret,
>FromMma(" n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]");
Error, (in MmaTranslator:-FromMma) incorrect syntax (at position 11) in last character of "...0)
r"

I don't know the use to me of having PDF exports having animations requiring huge emails since I don't own website. Yet, I've been fooling with Apple textbook maker app that has movie imort to PDFs. Someday, I'll use google drive links...

So, action item, maybe Maple would like to have a worksheet drop in to this apple textbook app Like movies. I hope it's easy from Apple taunting html5.

## Equidistant surface

by: Maple 15

Example of the equidistant surface at a distance of 0.25 to the surface
x3
-0.1 * (sin (4 * x1) + sin (3 * x2 + x3) + sin (2 * x2)) = 0
Constructed on the basis of universal parameterization of surfaces.

equidistant_surface.mw

 1 2 3 4 5 6 7 Page 1 of 7
﻿