I am trying to plot several vector fields on a surface in MAPLE. It will be a random one, a tangent field, and a gradient field.
Specifically, I'm stuck trying to restrict a 3D field to the surface only. I may not have taken the right approach...
Here's a couple first tries. With a vector field :
eqn:=(x^2+3*y^2)*exp(1/2*(-x^2-y^2)):
montagne:=plot3d(eqn,x = -3 .. 3, y = -3.6 .. 3.6,shading=zgrayscale,grid=[300,300],scaling=unconstrained):
vect := VectorField(<sin(y),x,z>,cartesian[x,y,z], output=plot,view=[-3..3,-3..3,0..2.3],fieldoptions=[fieldstrength=fixed,arrows=SLIM,grid=[10,10,10],axes=none,color="Red"]):
display(montagne, vect, orientation = [30, 70]);
Here's the gradient (I know it's not elegant code, but I need the directional derivatives to make different examples) :
with(Student[MultivariateCalculus]):
f := (x, y) -> eqn:
dir1:=(x) -> DirectionalDerivative(z-f(x,y),[x,y,z],[1,0,0]):
dir2:=(y) -> DirectionalDerivative(z-f(x,y),[x,y,z],[0,1,0]):
dir3:=(z) -> DirectionalDerivative(z-f(x,y),[x,y,z],[0,0,1]):
gradf2 := VectorField(<dir1(x),dir2(y),dir3(z)>,cartesian[x,y,z], output=plot,view=[-3..3,-3..3,0..2.3],fieldoptions=[arrows=SLIM,grid=[10,10,10],axes=none,color="Red"]):
display(montagne, gradf2, orientation = [30, 70]);
And what it looks like :
Any idea how I can "cut the field" ? Or at least draw tangent vectors on the surface in a controlled manner ? Thanks for your help