While working my way through the Wolfram Blog post on simulating fluid flow I started playing with StreamPlot
because I preferred quick and ugly visualizations over the ListIntegralConvolutionPlot
which simply tested my patience. When using StreamPlot
with the interpolated velocity vectors, however, the function would throw an error:
InterpolatingFunction::dmval: Input value {1.05051,1.05051} lies outside the range of data in the interpolating function. Extrapolation will be used. >>
An example that reproduces this error is:
u = Interpolation[
Flatten[Table[{{x, y}, -1 - x^2 + y}, {x, 0, 1, 0.1}, {y, 0, 1,
0.1}], 1]]
v = Interpolation[
Flatten[Table[{{x, y}, 1 + x - y^2}, {x, 0, 1, 0.1}, {y, 0, 1,
0.1}], 1]]
StreamPlot[{u[x, y], v[x, y]}, {x, 0, 1}, {y, 0, 1}]
It looks like a similar issue was observed in earlier versions of Mathematica with LogLinearPlot
. Following a similar troubleshooting process:
Reap@StreamPlot[{Sow[x], Sow[y]}, {x, 0, 1}, {y, 0, 1}];
%[[2]]
shows (I think, I'm not terribly comfortable with Reap/Sow) that StreamPlot
is polling the function at 1.05051.
{{1.05051, 1.05051, 1.05051, 1.05051, 0.,...}
Furthermore, the polling seems independent of the range for x or y supplied in the function.
In the end, the plot that is displayed with interpolated values is identical to the one made with the original equations (in this case). My concern is that this behavior may impact a subset of interpolated functions that do behave badly outside of their defined region and it would be good to be able to tell StreamPlot
that. Is it possible or is this a bug that we'll be stuck with until version 10 comes out?