Opened 13 years ago
Closed 12 years ago
#4182 closed defect (fixed)
[with patch, positive review] plot3d fails with 'IndexError: list index out of range'
Reported by: | jhpalmieri | Owned by: | was |
---|---|---|---|
Priority: | minor | Milestone: | sage-3.2 |
Component: | graphics | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: def g(x,y): ... if y <= 0 or y >= x**2: ... return 0 ... else: ... return 1 sage: plot3d(g, (-3, 3), (-3, 3), adaptive=True)
fails, returning
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/palmieri/.sage/sage_notebook/worksheets/admin/37/code/ 7.py", line 6, in <module> plot3d(g, (-Integer(3), Integer(3)), (-Integer(3), Integer(3)), adaptive=True) File "/usr/local/share/sage/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module> File "/home/palmieri/Documents/sage-3.1.2/local/lib/python2.5/site- packages/sage/plot/plot3d/plot3d.py", line 157, in plot3d P = plot3d_adaptive(f, urange, vrange, **kwds) File "/home/palmieri/Documents/sage-3.1.2/local/lib/python2.5/site- packages/sage/plot/plot3d/plot3d.py", line 255, in plot3d_adaptive G.set_texture(texture[k], opacity=opacity) IndexError: list index out of range
Attachments (1)
Change History (4)
Changed 13 years ago by
comment:1 Changed 13 years ago by
- Summary changed from plot3d fails with 'IndexError: list index out of range' to [with patch, needs review] plot3d fails with 'IndexError: list index out of range'
comment:2 Changed 12 years ago by
- Summary changed from [with patch, needs review] plot3d fails with 'IndexError: list index out of range' to [with patch, positive review] plot3d fails with 'IndexError: list index out of range'
This does fix the problem and looks ok.
comment:3 Changed 12 years ago by
- Resolution set to fixed
- Status changed from new to closed
Merged in Sage 3.2.alpha1
Note: See
TracTickets for help on using
tickets.
Here's a patch. I was getting an index error in the last line in this code snippet:
The function g(x,y) described above is discontinuous at various places, and I think this was making the
k
in the last line of this snippet equal to 128 whilelen(texture)
was also 128. Changing the definition ofspan
in the first line, as this patch does, I hope should makek
always strictly less thanlen(texture)
.