0

I want to create an animation of a surface when some parameter is changing, using for loop in maple to create a sequence of frames and they display them as sequence of plots. I was able to obtain an animation, however some of the frames are missing their middle portion. For example these are the i=11th and i=12th frames:

enter image description here

enter image description here

One can see that 11th frame has a cut in the middle. Here is the animationenter image description here

Since the surface on some of the frames is cut, the middle portion of the surface dissappears and then appears again.

Q: How to make this animation smooth so that the whole surface appears on each frame of the animation?

I attach the maple code I used to create the animation:

with(plots);
r := 'r';
theta := 'theta';
z := 'z';
for i from 0 to 50 do
    p || i := plots[implicitplot3d](abs(z) = EllipticE(sqrt(1-r^2/(1+(1/50)*i)), sqrt(1+(1/50)*i)), r = sqrt((1/50)*i) .. sqrt(1+(1/50)*i), theta = 0 .. 2*Pi, z = -1 .. 1, coords = cylindrical, numpoints = 1600)
end do;
plots[display](p || (0 .. 50), insequence = true);

Increasing numpoints doesn't solve the problem. In the displayed animation the value numpoints=16000 has been used.

Travis Willse
  • 99,363
  • I would venture to guess that this is a consequence of a rounding that occurs near a critical value of the argument function used by $\texttt{implicitplot3d}$: For some values of the time parameter, it simply doesn't find the intermediate solutions. – Travis Willse May 04 '16 at 14:49
  • @Travis that was my initial guess too, so I plotted using a different command without implicitplot3d: addcoords(z_cylindrical, [z, r, theta], [rcos(theta), rsin(theta), z]); with(plots); r := 'r'; theta := 'theta'; z := 'z'; for i from 0 to 50 do p || i := plot3d(EllipticE(sqrt(1-r^2/(1+(1/50)i)), sqrt(1+(1/50)i)), r = sqrt((1/50)i) .. sqrt(1+(1/50)i), theta = 0 .. 2*Pi, coords = z_cylindrical, numpoints = 5000) end do; plots[display](p || (0 .. 50), insequence = true); but still faced the same problem. – Martin Nicholson May 04 '16 at 15:00
  • I tried executing the latter code (on Maple 17), but it generated this error for every frame: http://www.maplesoft.com/support/help/errors/view.aspx?path=Warning,%20unable%20to%20evaluate%20the%20function%20to%20numeric%20values%20in%20the%20region%3B%20see%20the%20plotting%20command%27s%20help%20page%20to%20ensure%20the%20calling%20sequence%20is%20correct – Travis Willse May 04 '16 at 15:03
  • (That said, the original code in the question produces different and even more pathological results for me than it did for you.) – Travis Willse May 04 '16 at 15:05

1 Answers1

1

Roundoff error introduces imaginary artefacts near the boundary. One simple solution for this example is to wrap with the Re command.

restart;
with(plots): with(plottools):
addcoords(z_cylindrical, [z, r, theta],
          [r*cos(theta), r*sin(theta), z]);

expr := Re(EllipticE(sqrt(1-r^2/(1+(1/50)*i)), sqrt(1+(1/50)*i))):

for i from 0 to 50 by 1 do
  temp := plot3d(expr,
                 r = sqrt((1/50)*i) .. sqrt(1+(1/50)*i),
                 theta = 0 .. 2*Pi, coords = z_cylindrical);
  p[i] := display(temp,
                  reflect(temp,[[0,0,0],[1,0,0],[0,1,0]])):
end do:

display(seq(p[i],i=sort([indices(p,nolist)])), insequence = true); 

Another way to deal with imaginary components (being more careful about how they are discarded, based on magnitude) is to make use of the fnormal command instead of simply wrapping the expression in a call to Re.

I changed how the frames are stored, just for my own convenience. In the code above you can change the by 1 to say by 5 and get only one fifth as many frames but with the same end-point values for i.

In general you will get better performance and smaller plot structures and exported gifs if you can use plot3d (with coordinate system, say) than if you use implicitplot3d.

acer
  • 5,293