restart; with(plots): #Define a few useful functions: dprod := (a,b) -> sum(a[jj]*b[jj],jj=1..nops(a)): #Dot product cprod := (a,b) -> [ a[2]*b[3] - b[2]*a[3], - (a[1]*b[3] - a[3]*b[1]), a[1]*b[2] - a[2]*b[1]]: #Crossproduct len := a -> sqrt(dprod(a,a)): #Length of a vector #The next functions makes a tubular surface around the space curve gamma of radius rr, # given that the axes BB and NN are the unit binormal and unit normal to the curve: tubeit := (gamma,BB,NN,rr) ->expand(gamma+ rr*cos(theta)*BB + rr*sin(theta)*NN): #You can change the entries in the function on the next line as long as you keep it in terms of t. f := [t,t^2,t^3]: fp := diff(f,t): fpp := diff(fp,t): fppp := diff(fpp,t): T := expand(fp/len(fp)): #Unit Tangent B1 := cprod(fp,fpp): B := expand(B1/len(B1)): #Unit Binormal N := simplify(cprod(B,T)): # Unit Normal kappa := sqrt(dotprod(B1,B1))/sqrt(dotprod(fp,fp))^3: #Formula from the book for kappa (not used, but might be interesting) tau := simplify(dotprod(fppp,B1)/dotprod(B1,B1)): #Formula for torsion (not used, but might be interesting) plot3d(tubeit(f,B,N,.03),t=0..1,theta=0..2*Pi,color=magenta,grid=[30,10],axes=boxed);