1

I'd like to plot together a torus and a knot on it, that is, closed curve wrapping around the torus, $m$ times around a circle and $n$ times around the other circle.

It will be used to explain fundamental group of torus $\pi_1(T)\simeq \mathbb{Z}\oplus \mathbb{Z}$.

I think that there is a better way to plot the knot. Also, I'd like to change its thickness and colour.

If possible, I'd like to use selectors to change $m$ and $n$ interactively.

Code

rr = 2; 
torus[u_,v_] := {
  (rr + Cos[2 Pi u]) Cos[2 Pi v],
  (rr + Cos[2 Pi u]) Sin[2 Pi v], 
        Sin[2 Pi u]
 }
Toro = ParametricPlot3D[torus[u, v], {u, 0, 1}, {v, 0, 1}, 
   Boxed -> False, Axes -> False, MeshStyle -> None];
Knot = ParametricPlot3D[torus[u, 2 u], {u, 0, 1},  
   Boxed -> False, Axes -> False];
Show[Toro, Knot]

enter image description here

Sigur
  • 693
  • 5
  • 18

1 Answers1

2
 Manipulate[
 Module[{rr = 2},

  torus[u_, v_] := {(rr + Cos[2 \[Pi] u]) Cos[
      2 \[Pi] v], (rr + Cos[2 \[Pi] u]) Sin[2 \[Pi] v], 
    Sin[2 \[Pi] u]};

  Toro = ParametricPlot3D[torus[u, v], {u, 0, 1}, {v, 0, 1}, 
    Boxed -> False, Axes -> False, MeshStyle -> None];

  Knot = ParametricPlot3D[torus[m u, 2 n u], {u, 0, 1}, 
    Boxed -> False, Axes -> False, 
    PlotStyle -> {Thickness[0.01], Blue}]];

 Show[Toro, Knot],
 {{m, 3}, 1, 15, 1}, {{n, 4}, 1, 15, 1}]

Torus fig

David G. Stork
  • 41,180
  • 3
  • 34
  • 96