restart; with(plots): T := [cos(u)*(R+r*cos(v)), sin(u)*(R+r*cos(v)), r*sin(v)]; #Define a torus with two parameters, the inner radius r and the outer radius R. T1 := expand(subs(R=3,r=1,T)): #This gives a torus we can plot if we substitute for the parameters plot3d(T1,u=0..2*Pi,v=0..2*Pi,scaling=constrained); #Set up a loop to change the r and R values of the torus in an animation. n := 32; for i from 0 to n do rr := evalf(1 + 5*i/n); #The inner radius rr will go from 1 to 6 RR := evalf(4 + i/n): #The outer radius RR will go from 4 to 5 T1 := expand(subs(R=RR,r=rr,T)); T2 := expand(subs(R=RR,r=rr+1,T)): #Substitute to get a tori and a shell around it P1 := plot3d(T1,u=0..2*Pi,v=0..2*Pi,color=blue): P2 := plot3d(T2,u=0..2*Pi,v=0..2*Pi,style=wireframe,color=green): #Plot in different colors Q[i] := display({P1,P2}); #Display together and assign it to something with an index i od: display([Q[j] $j=0..n],insequence=true,scaling=constrained); #Create the animation