I have a function defined by
f[x_, y_] := 1/(x^2+1) + 1/(y^2+1);
I can plot this function perfectly.
Then I want to StreamPlot
the gradient of that function so I do:
myGrad[x_, y_] = Grad[f[x, y], {x, y}]]
(I also tried some different approaches with :=
and Evaluate
and Function
here.)
Sadly
StreamPlot[myGrad[x, y], {x, -2, 5}, {y, -2, 5}]
produces a blank plot. On the other hand, using the output as %xyz
from the myGrad
definition as the 1st argument in the StreamPlot
call, renders a plot.
So, how do I reuse a functions result as definition of a new function and use the new function in a plot?