Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.6K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Visualizing the gradient?

Posted 4 years ago
Attachments:
POSTED BY: Mitchell Sandlin
4 Replies

Thanks so much for your help, I certainly appreciate your comments and advice - they were of great use.

FYI - the arrow in my previous attached example is NOT pointing in the correct direction so it can be ignored. However, the large arrow has been an issue for some time and I was very glad to get it resolved.

Thanks Again,

Mitch Sandlin

POSTED BY: Mitchell Sandlin

The 3D visualization has an arrowhead size problem.

Show[Plot3D[{f[x, y]}, {x, -5, 5}, {y, -8, 8}, PlotRange -> {-5, 5}, 
  AspectRatio -> 1, AxesLabel -> Automatic],
 Graphics3D[{PointSize[Large], Black, Point[{P, P + Normalize[Q]}]}],
 Graphics3D[{Arrowheads[0.02], Arrow[{P, P + Normalize[Q]}]}], 
 ImageSize -> Large]

I am not sure about the direction -- I did not check that. Are you trying to plot a normal to the surface?

Regards

Neil

POSTED BY: Neil Singer

Hi Neil;

Thank you so much for your response, it answered my question exactly.

If I wanted to take the visualization up a notch and visualize the solution in both 2D and 3D, would the attached be a correct solution? Since I followed your example, I am pretty sure the 2D visualization is correct, but not real sure about the 3D visualization.

Thanks so much,

Mitch Sandlin

Attachments:
POSTED BY: Mitchell Sandlin

Mitchell,

Your problem is that you are computing the slope at point {-2,3} as Q2 -- this is correct, however, when you plot Q2 you plot it as a point. It is a direction -- your plot must add P2 plus some multiple of Q2. The multiple determines the vector length. For example, use P2+Normalize[Q2].

Using your example:

Show[ContourPlot[f[x, y], {x, -5, 10}, {y, -5, 10}],
 Graphics[{{PointSize[Large], Black, 
    Point[{P2, P2 + Normalize[Q2]}]}}],
 Graphics[Arrow[{P2, P2 + Normalize[Q2]}]],
 VectorPlot[Evaluate[Grad[f[x, y], {x, y}]], {x, -5, 10}, {y, -5, 10},
   VectorPoints -> 8, AxesLabel -> Automatic]]
POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard