1
$\begingroup$

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

$\endgroup$
3

1 Answer 1

2
$\begingroup$
 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

$\endgroup$

Your Answer

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

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