I'm beginner in the Mathematica and would like to do some animation based on curve function :

 function = Function[{u, v}, 
  Re[2 Exp[2 \[Pi] I (u + 2 v)] + 6 Exp[2 \[Pi] I (u - 2 v)]]];

After including this curve to the torus pattern :

torus parametric form :

x = Cos[2 Pi v] (2 + Cos[2 Pi u])
y = Sin[2 Pi v] (2 + Cos[2 Pi u])
z = Sin[2 Pi u]

How could I do animation :

  • Point moving on this curve
  • Winding curve on the torus

Could someone explain me how can i do this ?

Parametric curve form :

u = u(t)
v = v(t)
  • $\begingroup$ So the curve given by the function lies on surface of the torus, right? Can you also plot the curve (for a chosen arc length) using ParametricPlot3D and Show? $\endgroup$
    – Narasimham
    Commented May 18, 2016 at 12:09
  • $\begingroup$ I can visualize a point moving on the blue line, but it isn't clear what you mean by a curve winding on the torus. $\endgroup$
    – Jason B.
    Commented May 18, 2016 at 12:09
  • $\begingroup$ Yes, I mean visualize a point moving on the blue line, and the second is this line moving on the torus, same like a point, but it wont have point but just only curve moving on this torus. $\endgroup$
    – yearly
    Commented May 18, 2016 at 12:12
  • 1
    $\begingroup$ @AntonAntonov - I usually do like to just answer the unclear questions in what I take to be the most interesting interpretation... $\endgroup$
    – Jason B.
    Commented May 18, 2016 at 12:13
  • 2
    $\begingroup$ Related Q&A: (34888), (45417), (77887), (113156) $\endgroup$
    – Michael E2
    Commented May 18, 2016 at 12:14

2 Answers 2


Ok, lets go step by step. First you want to create a torus. The right parametric form is {Cos[v] (r + Cos[u]), Sin[v] (r + Cos[u]), Sin[u]}.

r = 2;
pl1 = ParametricPlot3D[{Cos[v] (r + Cos[u]), Sin[v] (r + Cos[u]), 
       Sin[u]}, {v, 0, 2 Pi}, {u, 0, 2 Pi}, Mesh -> False,
       PlotStyle -> Opacity[0.7]];

Then you want to make a line on this torus using u=u(t) and v=v(t). I took a trial for u=3t and v=2t.

pl2 =  ParametricPlot3D[Block[{u = 3 t, v = 2 t}, {Cos[v] (r + Cos[u]), 
        Sin[v] (r + Cos[u]), Sin[u]}], {t, 0, 2 Pi}, PlotStyle -> Thick];

Then combine them with Show. The extra point which is supposed to move, you can add as another Graphics3D object whose coordinate will be the animate variable like,

Animate[Show[pl1, pl2, Graphics3D[{Red,
  Sphere[Block[{u = 3 t0, v = 2 t0}, {Cos[v] (r + Cos[u]), 
  Sin[v] (r + Cos[u]), Sin[u]}], 0.1]}]],{t0,0,2 Pi}]

enter image description here

Honestly speaking I don't understand how you want to use the first function, but I guess this can give you a general guide.

And BTW, your function is simply f[x_,y_]=6 Cos[2 Pi x - 4 Pi y] + 2 Cos[2 Pi x + 4 Pi y].

  • $\begingroup$ Is it possible to find back what surface intersects the torus for parametrization $ (u =3 t, v = 2 t) ? $ $\endgroup$
    – Narasimham
    Commented May 19, 2016 at 19:46
  • $\begingroup$ I don't think @Narasimham there would be an unique solution. It is more like finding a curve passing through two given points. $\endgroup$
    – Sumit
    Commented May 19, 2016 at 20:36

ParametricPlot3D[ {(2 + Cos[ 2 Pi v]) Cos[ 2 Pi u], (2 + Cos[ 2 Pi v]) Sin[2 Pi u], Sin[2 Pi v]}, {v, 0, 1}, {u, 0, 1}]

You want to draw certain lines on above torus it appears.

Next,please describe the character of winding lines you choose to depict on it, as that comes at first. For example do you want to draw geodesics? loxodromes? Planar cut loci? Intersection with another surface? or what? Animation can come later on.

$u(t), v(t)$ is not specific enough. The first real part of exponential is not clear. Can you put that the line parametrization into the form:

$$ x(t),y(t),z(t) ? $$


Geodesics can be found by employing Clairaut's Law

$$ r\cdot \sin \alpha = r_{min}$$

Useful reference


If inner radius is $c$ then there are three possible scenarios for return of running geodesics.

If $ r_{min} < c $ geodesics cover the torus fully, criss crossing but running in same direction.

If $ r_{min} > c $ geodesics cover outside portion only, criss crossing while running to and fro.

If $ r_{min} = c $ geodesics asymptotically reach $ r_{min} = c $ towards an inner torus equator line of no return ... at the torus inner equatorial radius.


Since you left the choice of type of line to be drawn I chose edge lines of constant width strips. They can be used to wind closely packed copper wires for example on a toroidal solenoid. They are also geodesic parallel lines because separation between them is constant satisfying DE $ r\cdot \cos \alpha = const.$ They are orthogonal trajectories to geodesics.


So Viviani can join Sumit's bandwagon ! ( as $ u=v ?$ )

sph = {Sin[v] Cos[u], -Cos[v] Cos[u], Sin[u]}; 
cyl = {.5 Sin[p], -.5 - .5 Cos[p] , q} 
pl0 = ParametricPlot3D[cyl, {p, 0, 2 Pi}, {q, -1, 1}, Mesh -> False,     PlotStyle -> Opacity[0.3]]; 
pl1 = ParametricPlot3D[sph, {v, 0, 2 Pi}, {u, 0, 2 Pi}, Mesh -> False,
        PlotStyle -> Opacity[0.7]]; 
(* u=v=t for Viviani_Curve *) 
pl2 = ParametricPlot3D[Block[{u = t, v = t}, sph], {t, 0, 2 Pi}, PlotStyle -> Thick]; 
Animate[Show[pl1, pl0, pl2,    Graphics3D[{Red, Sphere[Block[{u = tz, v = tz}, sph], 0.04]}]], {tz,    0, 2 Pi}]
  • $\begingroup$ It can be geodesics curve. Could you give me an example with your choice curve ? It just have to wind on the torus. $\endgroup$
    – yearly
    Commented May 18, 2016 at 17:04
  • $\begingroup$ Suggest Villarceau Circle on torus as a simpler start example than geodesics. $\endgroup$
    – Narasimham
    Commented May 19, 2016 at 6:16
  • $\begingroup$ Please note $any $ arbitrary function $ f(u,v)=0 $ is okay for such a superscription, the particular choice depends on parametrization of two intersecting surfaces. $\endgroup$
    – Narasimham
    Commented May 19, 2016 at 19:29
  • $\begingroup$ Any choice of your sugestion will be ok, I have a free hand for eveything, It might be everything, but it has to show curve winding on the torus $\endgroup$
    – yearly
    Commented May 19, 2016 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.