# StreamPlot Failure

In versions 11.3 through 12.1, the following causes StreamPlot to fail:

StreamPlot[{
2.1 - 4 u - (8 (u - v) (1 - E^(8 (v - u)^2) + E^(8 (v - u)^2) (2 v - 1)^2 - (2 u - 1)^2))/
(E^(4 (2 u - 1)^2 - 8 (2 u - 1) (2 v - 1) + 4 (2 v - 1)^2) - 1),
2.1 - 4 v - (8 (v - u) (1 - E^(8 (u - v)^2) + E^(8 (u - v)^2) (2 u - 1)^2 - (2 v - 1)^2))/
(E^(4 (2 u - 1)^2 - 8 (2 u - 1) (2 v - 1) + 4 (2 v - 1)^2) - 1)}
, {u, 0, 1}, {v, 0, 1}]


After some Power::infy and Infinity::indet warnings, the final error is Throw::nocatch -- Uncaught Throw[Null, IntraStepEvaluationException]returned to top level.

In versions 11.2 and before, I get

Yes, the arguments definitely aren't well-defined when u == v (they're automatically generated within another function). However slightly changing any number of things (e.g. replacing 2.1 with 2.2, or changing the limits to {u, 10^-8, 1}, {v, 10^-8, 1}) results in valid output.

Maybe related to this problem?

Any thoughts on a general workaround for this idiosyncratic problem?

• In early versions, Plot used symmetric sampling and included the end points and allow Power::infy messages to come through. Then at some point WRI made it more robust at handling sinularities, and continued to improve it. Maybe because of user complaints. Maybe a similar approach will work for StreamPlot. Oct 17, 2019 at 10:58
• @MichaelE2 Maybe! To be clear, I don't mind the Power::infy warnings, it's the Throw::nocatch -- Uncaught Throw[Null, IntraStepEvaluationException] returned to top level. error with no output that bothers me. Oct 17, 2019 at 11:14
• The domain {u, 0.0001, 1}, {v, 0, 1} leads to the same problem with Throw, so it's not simply a symmetric domain or a problem at {0, 0}. Raising WorkingPrecision works in this case, too. As I meant to imply earlier, StreamPlot needs to be fixed to handle such exceptions. Oct 17, 2019 at 13:58

Here's another workaround: use arbitrary-precision numbers. (I suspect rounding errors lead to the exception.)

StreamPlot[{2.1 -
4 u - (8 (u - v) (1 - E^(8 (v - u)^2) +
E^(8 (v - u)^2) (2 v - 1)^2 - (2 u -
1)^2))/(E^(4 (2 u - 1)^2 - 8 (2 u - 1) (2 v - 1) +
4 (2 v - 1)^2) - 1),
2.1 - 4 v - (8 (v - u) (1 - E^(8 (u - v)^2) +
E^(8 (u - v)^2) (2 u - 1)^2 - (2 v -
1)^2))/(E^(4 (2 u - 1)^2 - 8 (2 u - 1) (2 v - 1) +
4 (2 v - 1)^2) - 1)},
{u, 0, 1}, {v, 0, 1},
WorkingPrecision -> 16]