Trefoil knot inside Torus

Topic:
Surface

Instructions - Part I:

Open GeoGebra in your desktop. Activate 2d and 3d graphics. You will be able to create a Torus with a trefoil knot inside. This is done using vector calculus, which requires lots of computations for the software, so you will need to have a powerful computer. The picture below shows an example of the result.
Image

Instructions - Part II

In the 2d graphics, create a button with the following GGB Script: #First define the components of the trefoil knot curve (it could be another curve in space R^3) rx(x)=(2 + cos(3 / 2 x)) cos(x) ry(x)=(2 + cos(3 / 2 x)) sin(x) rz(x)=sin(3 / 2 x) SetVisibleInView(rx,1,false) SetVisibleInView(ry,1,false) SetVisibleInView(rz,1,false) SetVisibleInView(rx,-1,false) SetVisibleInView(ry,-1,false) SetVisibleInView(rz,-1,false) ## #This defines the curve. To plot it write true below. r=Curve(rx(t),ry(t),rz(t), t, 0, 4π) SetVisibleInView(r,-1,false) ## #Calculate the derivative of each component of the curve and the norm drx(x)=Derivative(rx) dry(x)=Derivative(ry) drz(x)=Derivative(rz) SetVisibleInView(drx,1,false) SetVisibleInView(dry,1,false) SetVisibleInView(drz,1,false) SetVisibleInView(drx,-1,false) SetVisibleInView(dry,-1,false) SetVisibleInView(drz,-1,false) norma(x)=sqrt(drx(x)^2+dry(x)^2+drz(x)^2) SetVisibleInView(norma,1,false) SetVisibleInView(norma,-1,false) ## #Now calculate the tangent vector Trx(x)=drx/norma Try(x)=dry/norma Trz(x)=drz/norma SetVisibleInView(Trx,1,false) SetVisibleInView(Try,1,false) SetVisibleInView(Trz,1,false) SetVisibleInView(Trx,-1,false) SetVisibleInView(Try,-1,false) SetVisibleInView(Trz,-1,false) #Now calculate the normal vector dTrx(x)=Derivative(Trx) dTry(x)=Derivative(Try) dTrz(x)=Derivative(Trz) SetVisibleInView(dTrx,1,false) SetVisibleInView(dTry,1,false) SetVisibleInView(dTrz,1,false) SetVisibleInView(dTrx,-1,false) SetVisibleInView(dTry,-1,false) SetVisibleInView(dTrz,-1,false) normaT(x)=sqrt((dTrx)^2+(dTry)^2+(dTrz)^2) SetVisibleInView(normaT,1,false) SetVisibleInView(normaT,-1,false) Nrx(x)=dTrx/normaT Nry(x)=dTry/normaT Nrz(x)=dTrz/normaT SetVisibleInView(Nrx,1,false) SetVisibleInView(Nry,1,false) SetVisibleInView(Nrz,1,false) SetVisibleInView(Nrx,-1,false) SetVisibleInView(Nry,-1,false) SetVisibleInView(Nrz,-1,false) ## #Now calculate the binormal vector Brx(x)=Try*Nrz-Trz*Nry Bry(x)=Trz*Nrx-Trx*Nrz Brz(x)=Trx*Nry-Try*Nrx SetVisibleInView(Brx,1,false) SetVisibleInView(Bry,1,false) SetVisibleInView(Brz,1,false) SetVisibleInView(Brx,-1,false) SetVisibleInView(Bry,-1,false) SetVisibleInView(Brz,-1,false) ## #The components of the surface is defined here radius=(1/2) gx(x,y)=rx(x)+radius*(Nrx(x)*cos(y)+Brx(x)*sin(y)) gy(x,y)=ry(x)+radius*(Nry(x)*cos(y)+Bry(x)*sin(y)) gz(x,y)=rz(x)+radius*(Nrz(x)*cos(y)+Brz(x)*sin(y)) SetVisibleInView(gx,1,false) SetVisibleInView(gy,1,false) SetVisibleInView(gz,1,false) SetVisibleInView(gx,-1,false) SetVisibleInView(gy,-1,false) SetVisibleInView(gz,-1,false) #If you want to plot the surface uncomment the following line #surfaceKnot=Surface( gx(u,v), gy(u,v), gz(u,v), u, 0, 4 pi, v, 0, 2 pi ) value=2/3 pi #We need to define the norm separately considering the point "f(value)" normgf2(x,y)=(gx(x,y) -rx(value))^2+(gy(x,y)-ry(value))^2+(gz(x,y)-rz(value))^2 SetVisibleInView(normgf2,-1,false) #Finally, the surface that defines the torus with a trefoil knot. We use an inversion to the sphere and consider a point on the curve (knot). torusKnot=Surface((gx(t,theta)-rx(value))/normgf2(t,theta),(gy(t,theta)-ry(value))/normgf2(t,theta), (gz(t,theta)-rz(value))/normgf2(t,theta), t, 0, 4 pi, theta, 0, 2 pi)

Comments

There might be a more efficient method to do all this in GeoGebra. If you find one, let me know: j.ponce@uq.edu.au Another version that runs faster (online and in desktop) is here: Trefoil knot inside Torus II