# How to exclude a range of values in an interval

i'm trying to draw an irrotational vortex with this function:

ListVectorPlot[Table[{-y/(x^2 + y^2), x/(x^2 + y^2)}, {x, -3, 3, 3}, {y, -3, 3, 3}]]


But as you can see this function has a singularity in the origin, so how can i exclude a certain range of values close to the origin?

Thanks?

• Could use If[] in Table[] to eliminate the singular points at the outset. – J. M.'s technical difficulties Oct 15 '18 at 9:09
• Thanks but how? If[x==y==0, ?, ?] – MementoMori Oct 15 '18 at 9:16
• Yes, like that. Table[If[x == y == 0, {0, 0}, (* stuff *)], (* stuff *)]. – J. M.'s technical difficulties Oct 15 '18 at 9:23

A bit hacky, but you can do this:

Quiet[
ListVectorPlot[
Table[
{-y/(x^2 + y^2), x/(x^2 + y^2)},
{x, -3, 3, 1}, {y, -3, 3, 1}
] /. Indeterminate -> 0
]
]


ListVectorPlot[
Table[{y/(x^2+y^2+2),-x/(x^2+y^2+2)},{x,-3,3,0.3},{y,-3,3,0.3}],PlotTheme -> "Minimal"]


You can pre-specify the points you wish to plot. Here's one way of doing so using CirclePoints, which allows you to easily specify a minimum radius:

With[{pts =
Flatten[Table[CirclePoints[n/2, 4*n + 1], {n, 1, 6}], 1]},
ListVectorPlot[
N@Map[Replace[p : {x_, y_} :> {p, {-y, x}/(x^2 + y^2)}], pts]]]