Sample Maple Worksheet to create a torus and use a set of sample paths.restart;with(plots):f:=cos(beta)*(cos(alpha)+2): g:=sin(beta)*(cos(alpha)+2): h:=sin(alpha):Torus1:=plot3d([f,g,h],alpha=0..2*Pi,beta=0..2*Pi,scaling=constrained,style=wireframe,shading=ZHUE,transparency=0.75):Path2AF:=subs({beta=0,alpha=Pi*t},f), subs({beta=0,alpha=Pi*t},g), subs({beta=0, alpha=Pi*t},h):Path2BF:=subs({beta=Pi*t,alpha=Pi},f), subs({beta=Pi*t,alpha=Pi},g), subs({beta=Pi*t, alpha=Pi},h):Path2CF:=subs({beta=Pi,alpha=Pi*t},f), subs({beta=Pi,alpha=Pi*t},g), subs({beta=Pi, alpha=Pi*t},h):Path2A:=spacecurve([Path2AF,t=0..1],color=black, thickness=5):Path2B:=spacecurve([Path2BF,t=0..1],color=black, thickness=5):Path2C:=spacecurve([Path2CF,t=0..1],color=black, thickness=5):display3d({Torus1, Path2A, Path2B, Path2C});Sample path: Optimizing a parameterIn (beta, alpha), this path will take us from (0,0) to (k, pi) to (pi-k, pi) down to (pi, 0), so we'll again have three paths.xt:=k*t; yt:=Pi*t;Path3AF:=subs({beta=xt,alpha=yt},f), subs({beta=xt,alpha=yt},g), subs({beta=xt, alpha=yt},h);xt:=k*(1-t)+(Pi-k)*t; yt:=Pi;Path3BF:=subs({beta=xt,alpha=yt},f), subs({beta=xt,alpha=yt},g), subs({beta=xt, alpha=yt},h);xt:=(Pi-k)*(1-t)+Pi*t; yt:=Pi*(1-t);Path3CF:=subs({beta=xt,alpha=yt},f), subs({beta=xt,alpha=yt},g), subs({beta=xt, alpha=yt},h);dP1:=diff([Path3AF],t); dP2:=diff([Path3BF],t); dP3:=diff([Path3CF], t);Integrand1:=simplify(dP1[1]^2+dP1[2]^2+dP1[3]^2);Integrand2:=simplify(dP2[1]^2+dP2[2]^2+dP2[3]^2);Integrand3:=simplify(dP3[1]^2+dP3[2]^2+dP3[3]^2);PathLength:=Int(sqrt(Integrand1),t=0..1)+simplify(int(sqrt(Integrand2),t=0..1))+Int(sqrt(Integrand3),t=0..1);plot(PathLength,k=0..Pi/2);dPath:=diff(PathLength,k);plot(dPath,k=0..Pi/2);BestK:=fsolve(dPath=0,k=Pi/4..5*Pi/16);evalf(subs(k=BestK,PathLength));Path3A:=subs(k=BestK,[Path3AF]);Path3B:=subs(k=BestK,[Path3BF]);Path3C:=subs(k=BestK,[Path3CF]);P1:=spacecurve(Path3A,t=0..1,color=black,thickness=5):
P2:=spacecurve(Path3B,t=0..1,color=black,thickness=5):
P3:=spacecurve(Path3C,t=0..1,color=black,thickness=5):display3d(Torus1,P1,P2,P3);