Mathematica Mathematica, gradient plot on the graph

Click For Summary
The discussion revolves around plotting a vector field defined by the gradient of the function x^2 + y^2, specifically at points on the paraboloid. The user initially attempted to create a 3D vector plot using ListVectorPlot3D but encountered issues due to incorrect data formatting. They then successfully generated the vector field using VectorPlot3D and created a 3D plot of the paraboloid with Plot3D, combining both visualizations with the Show function. However, the user seeks advice on adjusting the plot so that the arrows representing the vectors start at the specified points rather than being centered on them.
PeetPb
Messages
29
Reaction score
0
Hi,
I need to plot a vector field 2x,2y,0 which is the gradient of the function x^2+y^2. I need to plot it only in some interesting points (points on the paraboloid x^2+y^2). So I tried something like

a=Table[{{x,y,x^2+y^2},{2x,2y,0}},{x,-2,2,0.5},{y,-2,2,0.5}]
ListVectorPlot3D[a]

It did not work. The definition of ListVectorPlot3D[{{x,y,z},{a,b,c}},...] says that it generates a 3D vector plot from vector field values {a,b,c} given at specified points {x,y,z}.

Any idea how I might plot that gradient on the paraboloid ? It would be really unpleasant if I had to do every single vector with Graphics3D[]

thanks
 
Physics news on Phys.org
Code:
pnts = Flatten[Table[{x, y, x^2 + y^2}, {x, -2, 2, 1/4}, {y, -2, 2, 1/4}], 1];

plv = VectorPlot3D[{2 x , 2 y, 0}, {x, -2, 2}, {y, -2, 2}, {z, 0, 8},  VectorPoints -> pnts, VectorColorFunction -> "ThermometerColors",    VectorScale -> Small];

plp = Plot3D[x^2 + y^2, {x, -2, 2}, {y, -2, 2},  ColorFunction -> "GrayTones", BoxRatios -> {3, 3, 2}];

Show[plp, plv, ImageSize -> 600]

Gives me this: It took me a bit of time, but I have always wanted to learn how to do this anyway so 30 minutes well spent.

Does anyone know how i can make the arrows START at the point rather than be centered at it?
 

Attachments

  • arrowsonparabola.jpg
    arrowsonparabola.jpg
    36.4 KB · Views: 1,378
Last edited:

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K