Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plot the intersection of two surfaces

This is a nice 3D plot

var('x,y,z')
U(x,y)=x^(1/2)*y^(1/2)
B(x,y)= (1/16)*x + y
#levels=[0.25,.5,0.75,1,1.25,1.5,1.75,2]
epsilon=0.01
p=plot3d(U(x,y),(x,0,2),(y,0,2),color='lightgreen',opacity=0.7,frame=False)
#for h in levels:
#    p+=implicit_plot3d(U(x,y)==h,(x,0,2),(y,0,2),(z,h,h+epsilon),color='red')
#    p+=implicit_plot3d(U(x,y)==h,(x,0,2),(y,0,2),(z,0,0.01),color='red')
from sage.manifolds.utilities import set_axes_labels
p+= arrow3d((0, 0, 0), (2.2, 0, 0), color='green')
p+= arrow3d((0, 0, 0), (0, 2.2, 0), color='green')
p+= arrow3d((0, 0, 0), (0, 0, 2.2), color='green')
p+=plot3d(B(x,y),(x,0,2),(y,0,2),color='pink',opacity=0.7,frame=False)
po2={'fontsize':20,'color':'black'}
t=text3d("x",(2.4,0,0),**po2)       
t+=text3d("y",(0,2.4,0.0),**po2)            
t+=text3d("U",(0.,0.0,2.4),**po2)
p+= text3d(r"U(x,y) = xᐧ⁵yᐧ⁵ ", (1, 1, 2.5), color=(0.5, 0, 0))
p+= set_axes_labels(p, r"x",r"y",r"z", color='lightgreen', fontweight='bold')
show(p,viewer='threejs',frame=False)

But I would like to add the intersection line of U and B in the plot. I have tried many solution without any success. Could some one gives a little help because I do not understand a word of https://ask.sagemath.org/question/33418/plot-the-intersection-of-two-surfaces-or-solutions-of-a-system-of-eqs/ which seems normal since it is written thas This post is a wiki. Anyone with karma > 750 is welcome to impove it