Some frames are missing part of a surface in Maple $\texttt{implicitplot3d}$ animation

122 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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.