Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The following code may serve as a starting point:

@interact
def ellipsoid(a=slider(1,5,step_size=0.2,default=3),
              b=slider(1,5,step_size=0.2,default=3),
              c=slider(1,5,step_size=0.2,default=2),
              color=selector(["red","green","blue"],label="Color",default="green")):
    x1, x2, y1, y2, z1, z2 = -a, a, -b, b, -c, c
    var("x,y,z")
    figure = implicit_plot3d(x^2/a^2+y^2/b^2+z^2/c^2==1, (x,x1,x2), (y,y1,y2), (z,z1,z2),
                             color=color, viewer='threejs')
    show(figure)

It can be seen in action here. You may want to read this tutorial as well as these examples about the @interact command