1 | initial version |
I incorporated the suggestions and worked the bounds into two different loops. Seems to have fixed it.
u,v = var('u,v')
def is_even(n):
return n%2 == 0
def c(n):
return 2/3*(4^(n+1)-4)
def torus(n,u,v):
if is_even(n):
return [(2*4**n + 4**n*cos(u))*cos(v), (2*4**n + 4**n*cos(u))*sin(v)+c(n), 4**n*sin(u)]
else:
return [4**n*sin(u), (2*4**n + 4**n*cos(u))*sin(v)+c(n), (2*4**n + 4**n*cos(u))*cos(v)]
T0 = []
for i in srange(0,2*pi+0.1, 0.1):
T0.append(parametric_plot3d(torus(0,u,v), (u,0,2*pi),(v,i, i+0.1), aspect_ratio=1, frame=False, axes=False))
T = []
for i in range(len(T0)):
T.append(sum(T0[j] for j in range(i)))
a = animate(T)
a.show()