0

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)
Sumit
  • 15,912
  • 2
  • 31
  • 73
yearly
  • 103
  • 3
  • 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? – Narasimham May 18 '16 at 12:09
  • 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. – Jason B. May 18 '16 at 12:09
  • 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. – yearly May 18 '16 at 12:12
  • @JasonB Just do it! :) – Anton Antonov May 18 '16 at 12:12
  • 1
    @AntonAntonov - I usually do like to just answer the unclear questions in what I take to be the most interesting interpretation... – Jason B. May 18 '16 at 12:13
  • 2
  • @MichaelE2 Thanks for posting the related questions! – Anton Antonov May 18 '16 at 12:17
  • @Michael E2 link this looks exactly what i want but not on surface. I do not know how can i do the same with torus – yearly May 18 '16 at 12:19
  • In bob's answer, s is the torus; then you need a parametrization of your curve. Do you have one? (Your function seems to be a real-valued function of two variables. I'm not sure how that relates to a curve. Is it meant to define a mesh on the surface? Doing this with MeshFunctions may not be possible.) – Michael E2 May 18 '16 at 12:34
  • I did edition on parametric equantion. @Michael E2 – yearly May 18 '16 at 12:41
  • @DerpyUnKnown - When you plot the parameterization you give, this results, which doesn't look so much like the curve on the torus – Jason B. May 18 '16 at 12:47
  • Im sorry, got confusef, i edid and added paramteric form for torus and parametric form for curve – yearly May 18 '16 at 12:52
  • Also somewhat related and very cool: bagels – Jens May 18 '16 at 17:55
  • @DerpyUnKnown So far you have not clarified or specified the function thing to define how you wish the lines to be drawn. I suppose even if that part is deleted the answerers here would suggest several nice options. – Narasimham May 19 '16 at 06:27

2 Answers2

6

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].

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

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) ? $$

EDIT1:

Geodesics can be found by employing Clairaut's Law

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

Useful reference

TorusGeodesicsRef

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.

EDIT2:

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.

Geodesic_Parallels_on_Torus

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}]
Narasimham
  • 3,160
  • 13
  • 26
  • It can be geodesics curve. Could you give me an example with your choice curve ? It just have to wind on the torus. – yearly May 18 '16 at 17:04
  • Suggest Villarceau Circle on torus as a simpler start example than geodesics. – Narasimham May 19 '16 at 06:16
  • 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. – Narasimham May 19 '16 at 19:29
  • 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 – yearly May 19 '16 at 20:14