Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: SageTour
Views: 143
Kernel: SageMath 7.6

3-dimensional plot of functions with SageMath

%display latex
x, y = var('x y') g1 = plot3d(sin(x*y), (x,-pi,pi), (y,-pi,pi), color='green') show(g1, viewer='threejs')
g1 = plot3d(sin(x*y), (x,-pi,pi), (y,-pi,pi), color='green', plot_points=100) show(g1, viewer='threejs')
g2 = sphere() show(g1+g2, viewer='threejs')
show(g1+g2, viewer='tachyon', aspect_ratio=1, figsize=10)
Image in a Jupyter notebook
u, v = var('u v') f1 = (4+(3+cos(v))*sin(u), 4+(3+cos(v))*cos(u), 4+sin(v)) f2 = (8+(3+cos(v))*cos(u), 3+sin(v), 4+(3+cos(v))*sin(u)) g1 = parametric_plot3d(f1, (u,0,2*pi), (v,0,2*pi), color="red") g2 = parametric_plot3d(f2, (u,0,2*pi), (v,0,2*pi), color="gold") show(g1+g2, viewer='threejs')
show(g1+g2, aspect_ratio=1, figsize=10)

Implicit plots

phi = golden_ratio() z = var('z') F = 2 - (cos(x+phi*y) + cos(x-phi*y) + cos(y+phi*z) + cos(y-phi*z) + cos(z-phi*x) + cos(z+phi*x)) r = 4.77 g1 = implicit_plot3d(F, (x,-r,r), (y,-r,r), (z,-r,r), plot_points=40, color='darkkhaki') show(g1, viewer='threejs')