# Changes to StreamPlot in v11.1 breaking my code

The code below used to work nicely in 11.0:

ϕc[x_, y_, α_] = r^(Pi/α) Cos[Pi/α θ] /. {r -> Sqrt[x^2 + y^2], θ -> ArcTan[x, y]};
StreamPlot[
{D[ϕc[x, y, α], x], D[ϕc[x, y, α], y]} /. α -> Pi/2, {x, 0.001, 3}, {y, 0.001, 3}]


but in 11.1 the functions in StreamPlot get the values of x and y substituted in before the derivative is evaluated, with consequent General::ivar: 0.0012142143 is not a valid variable errors. I can do something like

ϕc[x_, y_, α_] = r^(Pi/α) Cos[Pi/α θ] /. {r -> Sqrt[x^2 + y^2], θ -> ArcTan[x, y]};
f = D[ϕc[x, y, α], x] /. α -> Pi/2;
g = D[ϕc[x, y, α], y] /. α -> Pi/2;
StreamPlot[{f, g}, {x, 0.001, 3}, {y, 0.001, 3}]


Of course, but that's kind of clunky. Long story short, I think my question is how do I create "inline definitions" of the kind of functions I have in the example above?

P.S.: And why in all the world does Wolfram introduce substantial changes like that in a minor version update, or at all?

• Try StreamPlot[{Derivative[1, 0, 0][ϕc][x, y, π/2], Derivative[0, 1, 0][ϕc][x, y, π/2]}, {x, 0.001, 3}, {y, 0.001, 3}]. – J. M.'s discontentment Oct 31 '17 at 20:35
• Use the option Evaluated->True to obtain the M11.0 behavior, or wrap the first argument in Evaluate. – Carl Woll Oct 31 '17 at 20:37

As Carl Woll suggests in the comments, you should use the option Evaluated->True to reproduce the version 11.0 behavior, or wrap the first argument in Evaluate:

StreamPlot[
{D[ϕc[x, y, α], x], D[ϕc[x, y, α], y]} /. α -> Pi/2, {x, 0.001, 3}, {y, 0.001, 3},
Evaluated -> True] StreamPlot[Evaluate[{D[ϕc[x, y, α], x], D[ϕc[x, y, α], y]} /. α -> Pi/2],
{x, 0.001, 3}, {y, 0.001, 3}]


(output is the same).

The first method is recommended because Evaluated->True localizes the variables during symbolic evaluation, as opposed to wrapping the first argument by Evaluate.