Plot picewise function + infinity, error message
If I define a piecewise function from -infinity to +infininty, and I want to plot it, I get an error message like below. Any ideas how to fix this? Any workarounds?
f = Piecewise([[(-infinity,1),1],[(1,+infinity),2]])
plot(f)
Traceback (most recent call last):
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 657, in wrapper
return func(*args, **kwds)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 504, in wrapper
return func(*args, **options)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3058, in plot
G = funcs.plot(*args, **original_opts)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/functions/piecewise.py", line 1018, in plot
return sum([plot(f, a, b, *args, **kwds) for (a,b),f in self.list()])
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 657, in wrapper
return func(*args, **kwds)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/decorators.py", line 504, in wrapper
return func(*args, **options)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3077, in plot
G = _plot(funcs, (xmin, xmax), *args, **kwds)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/plot/plot.py", line 3180, in _plot
data = generate_plot_points(f, xrange, plot_points, adaptive_tolerance, adaptive_recursion, randomize)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/plot/plot.py", line 4180, in generate_plot_points
data = srange(*ranges[0], include_endpoint=True)
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/misc.py", line 1149, in srange
L = list(xsrange(start,end,step,universe,check,include_endpoint,endpoint_tolerance))
File "/opt/sage-4.7.1-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/misc.py", line 1242, in xsrange
icount = int(math.ceil(float(count) - endpoint_tolerance))
ValueError: cannot convert float NaN to integer