var('x,y,z')
# Write the equation as F(x,y,z) = 0
@interact
def _(F = input_box(default=y*ln(x*z^2)-2,label='0 = F(x,y,z) = '),location=input_grid(1, 3, default=[e,2,1], label = "Location (x,y,z) = ", width=3)):
x0 = location[0][0]
y0 = location[0][1]
z0 = location[0][2]
Fx = diff(F,x)
Fy = diff(F,y)
Fz = diff(F,z)
a = Fx(x=x0,y=y0,z=z0)
b = Fy(x=x0,y=y0,z=z0)
c = Fz(x=x0,y=y0,z=z0)
G = implicit_plot3d(F,(x,x0-1,x0+1),(y,y0-1,y0+1),(z,z0-1,z0+1))
G += point3d((x0,y0,z0),color='red',size=25)
G += arrow((x0,y0,z0),(x0+a,y0+b,z0+c),color='green')
G += implicit_plot3d(a*(x-x0)+b*(y-y0)+c*(z-z0),(x,x0-1/2,x0+1/2),(y,y0-1/2,y0+1/2),(z,z0-1,z0+1),color='yellow')
show(G,aspect_ratio=true)
|
Click to the left again to hide and once more to show the dynamic interactive window
|