In [1]:
var('x,y,z')
cm = colormaps.RdYlGn
t=5
xvals=(x,-t,t); yvals = (y,-t,t)
zvals = (z,-t,t)
#AXES
origin=(0,0,0)
#set size (for how long axes are). This is a bit larger than the 
#max of the largest x, y val; you may want to change it based on your function
size = 1.1*max(xvals[-1],yvals[-1],zvals[-1])
xSize=size; ySize= size; zSize=size
# xAxis = plot(vector((xSize,0,0)),color='blue',width=3)
xAxis = arrow3d((5,0,0), (-5,0,0),color='blue',width=3)
# yAxis = plot(vector((0,ySize,0)),color='red',width=3)
yAxis = arrow3d((0,5,0), (0,-5,0),color='red',width=3)
zAxis = arrow3d((0,0,-5), (0,0,5),color='green',width=3)
#Labels for axes
#set fontsize (change if you need to)
fsize=20
xT=text3d("x",(xSize*1.1,0,0),color='blue',fontsize=fsize)
yT=text3d("y",(0,ySize*1.1,0),color='red',fontsize=fsize)
zT=text3d("z",(0,0,zSize*1.1),color='green',fontsize=fsize)
axes = xAxis+xT+yAxis+yT+zAxis+zT


s1 = implicit_plot3d(1+sqrt(1 - (y -1)^2)==z, (x,0,2), (y,0,1), (z,-5,5), adaptive=False, color='red',frame=True, 
               axes_labels=['$x$ axis','$y$ axis', '$z$ axis'])

s2 = implicit_plot3d(z==0, (x,0,2), (y,0,1), (z,-5,5), adaptive=False, color='purple',frame=True, 
               axes_labels=['$x$ axis','$y$ axis', '$z$ axis'])

p = axes+s1+s2
show(p, frame=True, viewer='threejs', figsize=32)

Exercice A.2.5

In [13]:
var('x,y,z')
cm = colormaps.RdYlGn
t=5
xvals=(x,-t,t); yvals = (y,-t,t)
zvals = (z,-t,t)
#AXES
origin=(0,0,0)
#set size (for how long axes are). This is a bit larger than the 
#max of the largest x, y val; you may want to change it based on your function
size = 1.1*max(xvals[-1],yvals[-1],zvals[-1])
xSize=size; ySize= size; zSize=size
# xAxis = plot(vector((xSize,0,0)),color='blue',width=3)
xAxis = arrow3d((5,0,0), (-5,0,0),color='blue',width=3)
# yAxis = plot(vector((0,ySize,0)),color='red',width=3)
yAxis = arrow3d((0,5,0), (0,-5,0),color='red',width=3)
zAxis = arrow3d((0,0,-5), (0,0,5),color='green',width=3)
#Labels for axes
#set fontsize (change if you need to)
fsize=20
xT=text3d("x",(xSize*1.1,0,0),color='blue',fontsize=fsize)
yT=text3d("y",(0,ySize*1.1,0),color='red',fontsize=fsize)
zT=text3d("z",(0,0,zSize*1.1),color='green',fontsize=fsize)
axes = xAxis+xT+yAxis+yT+zAxis+zT



s1 = implicit_plot3d(x^2 + y^2==4, (x,-5,5), (y,-5,5), (z,0,5), adaptive=False, color='red',frame=True, 
               axes_labels=['$x$ axis','$y$ axis', '$z$ axis'])

s2 = implicit_plot3d(x^2 + y^2==9, (x,-5,5), (y,-5,5), (z,0,5), adaptive=False, color='purple',frame=True, 
               axes_labels=['$x$ axis','$y$ axis', '$z$ axis'])
                     
s3 = implicit_plot3d(sqrt(x^2 + y^2)==z, (x,-5,5), (y,-5,5), (z,0,5), adaptive=False, color='purple',frame=True, 
               axes_labels=['$x$ axis','$y$ axis', '$z$ axis'])
                     
p = axes+s3
show(p, frame=True, viewer='threejs', figsize=32)
In [ ]:
 
In [ ]: