CoCalc Public Filestorus_knot_cones.sagewsOpen with one click!
Author: Kyle Ormsby
Views : 154
License: item_0
Description: Parametrizes (p,q) torus knots and draws cones on them.
Compute Environment: Ubuntu 20.04 (Default)
var('t u', domain='real'); def torus_knot(rates): cpx_expr = 2 + exp(2*pi*I*rates[1]*t); [u,v] = [cpx_expr.real(),cpx_expr.imag()]; [x,y,z] = [cos(2*pi*rates[0]*t)*u,sin(2*pi*rates[0]*t)*u,v]; return [x,y,z] cm = colormaps.rainbow; def c(t,u): return 1-(u-1)^2; def curve_cone(gamma,t0,t1,P): #gamma a space curve parametrized by t for t0 ≤ t ≤ t1, P = point [x,y,z] [g1,g2,g3] = gamma; [x,y,z] = P; return parametric_plot3d([(1-u)*g1+u*x,(1-u)*g2+u*y,(1-u)*g3+u*z],(t,t0,t1),(u,0,1),plot_points=200,opacity=0.3,color=(c,cm)); curve_cone(torus_knot([3,5]),0,1,[0,0,-3])
(t, u)
3D rendering not yet implemented