When I plot
r[x_, y_] := Sqrt[x^2 + y^2];
θ[x_, y_] := ArcTan[x, y];
a=3;
Q[k_, N_] := Module[{pts1}, pts1 = Table[{0, x}, {x, -2 N, 2 N, 0.5}];
StreamPlot[{-Cos[θ[x, y] k] a^(1/2)/r[x, y]^(
1/2) + (1 - Sin[θ[x, y] k]^2 a/r[x, y])^(1/2) +
a^(1/2)/r[x, y]^(1/2) Cos[θ[x, y] k],
a^(1/2)/r[x, y]^(1/2) Sin[θ[x, y] k]}, {x, -2 N,
2 N}, {y, -2 N, 2 N}, PlotRange -> {Full, Full},
RegionFunction -> Function[{x, y}, x^2 + y^2 > a^2],
StreamPoints -> {pts1, Automatic, Scaled[2]},
StreamStyle -> {Blue, Thick, "Line"}, PerformanceGoal -> "Quality",
StreamScale -> Full]
Mathematica doesn't give any output.
Whereas, if I put the Abs around the square root bit, plotting something similar to what is shown here it works, even if I am not sure that those discontinuities in the gradients should appear (I mean the spikes near the x axes).
I report the code for the second case, the one that works, and the figure:
r[x_, y_] := Sqrt[x^2 + y^2];
θ[x_, y_] := ArcTan[x, y];
a = 3;
Q[k_, N_] :=
Module[{pts1}, pts1 = Table[{0, x}, {x, -2 N, 2 N, 0.5}];
StreamPlot[{-Cos[θ[x, y] k] a^(1/2)/r[x, y]^(1/2) +
Abs[(1 - Sin[θ[x, y] k]^2 a/r[x, y])]^(1/2) +
a^(1/2)/r[x, y]^(1/2) Cos[θ[x, y] k],
a^(1/2)/r[x, y]^(1/2) Sin[θ[x, y] k]}, {x, -2 N,
2 N}, {y, -2 N, 2 N}, PlotRange -> {Full, Full},
RegionFunction -> Function[{x, y}, x^2 + y^2 > a^2],
StreamPoints -> {pts1, Automatic, Scaled[2]},
StreamStyle -> {Blue, Thick, "Line"}, PerformanceGoal -> "Quality",
StreamScale -> Full]]
Q[1/2, 10]
What is wrong with that square root?
RegionPlot[(1 - Sin[\[Theta][x, y]/2]^2 a/r[x, y]) < 0, {x, -10, 10}, {y, -10, 10}]
$\endgroup$