# StreamPlot and VectorPlot handling of functions with singularities

Mathematica's Plot can handle plotting functions with singularities

You can plot functions that have singularities. The Wolfram Language will try to choose appropriate scales.

But StreamPlot and VectorPlot do not.

I am trying to plot functions using StreamPlot, but I do not know beforehand what these functions are, other than they depend on x and y. Some of them can have singularity at origin or somewhere else.

I selected a small region around the origin. Here is an example

ClearAll[f,x,y];
f = (2*x*y)/(x^2 - y^2);
StreamPlot[{1, f}, {x, -2, 2}, {y, -2, 2}];


Also Exclusions option is not supported by StreamPlot

What would be the correct way to StreamPlot such functions and avoiding 1/0 error?

• You still get the (correct) plot though. Right ? – Lotus Jul 19 '18 at 10:00
• @Lotus Yes, the plots comes out. Sorry I did not mention this. I just need a way to do it without the error message coming out, like with the Plot command. – Nasser Jul 19 '18 at 10:10
• Nasser, does this work for you: dom = FunctionDomain[f, {x, y}]; StreamPlot[{1, If[dom, f]}, {x, -2,2},{y,-2,2}]? – kglr Jul 19 '18 at 11:35
• Maybe try Quiet? – Mariusz Iwaniuk Jul 19 '18 at 11:39
• @MariuszIwaniuk Yes, I know this is an option always, but I was hoping to see if there is a less brute force method. For me Quiet feels like hiding the main issue under the cover. Thanks. – Nasser Jul 19 '18 at 12:09

ClearAll[f, x, y];