Opened 13 years ago

Closed 13 years ago

#2038 closed defect (duplicate)

[with patch, with negative review] plotting -- error message when failing to evaluate at a point is now sucky (it used to be good)

Reported by: was Owned by: was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: graphics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

It used to be that this would give a sensible error message about the number of points at which evaluating the function failed (and what the first error was):

sage: plot(factorial,(2,10))
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/Users/was/<ipython console> in <module>()

/Users/was/s/local/lib/python2.5/site-packages/sage/plot/plot.py in __call__(self, funcs, *args, **kwds)
   3343             # if there is one extra arg, then it had better be a tuple
   3344             elif n == 1:
-> 3345                 G = self._call(funcs, *args, **kwds)
   3346             elif n == 2:
   3347             # if ther eare two extra args, then pull them out and pass them as a tuple

/Users/was/s/local/lib/python2.5/site-packages/sage/plot/plot.py in _call(self, funcs, xrange, parametric, polar, label, **kwds)
   3419         del options['plot_division']
   3420         while i < len(data) - 1:
-> 3421             if abs(data[i+1][1] - data[i][1]) > max_bend:
   3422                 x = (data[i+1][0] + data[i][0])/2
   3423                 try:

<type 'exceptions.TypeError'>: 'float' object is unsubscriptable

The exception of course should mention that:

sage: factorial(1.5)
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/Users/was/<ipython console> in <module>()

/Users/was/s/local/lib/python2.5/site-packages/sage/rings/arith.py in factorial(n, algorithm)
    273     Z = integer_ring.ZZ
    274     if algorithm == 'gmp':
--> 275         return Z(n).factorial()
    276     elif algorithm == 'pari':
    277         return Z(pari('%s!'%Z(n)))

/Users/was/integer_ring.pyx in sage.rings.integer_ring.IntegerRing_class.__call__()

<type 'exceptions.TypeError'>: Attempt to coerce non-integral RealNumber to Integer

Attachments (1)

plot.patch (1.7 KB) - added by moretti 13 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 13 years ago by was

See also #2045.

Changed 13 years ago by moretti

comment:2 Changed 13 years ago by moretti

Please review this fix.

comment:3 Changed 13 years ago by moretti

Actually, the fix that I posted only fixes http://trac.sagemath.org/sage_trac/ticket/2038 which was listed as a dupe of this bug, but in fact is not. I will fix the issue reported here and provide another fix.

comment:4 Changed 13 years ago by moretti

  • Summary changed from plotting -- error message when failing to evaluate at a point is now sucky (it used to be good) to [with patch, needs review] plotting -- error message when failing to evaluate at a point is now sucky (it used to be good)

Check out empty_plot_list.patch; together with plot.patch it fixes both this ticket and http://trac.sagemath.org/sage_trac/ticket/2045.

comment:5 Changed 13 years ago by ncalexan

  • Summary changed from [with patch, needs review] plotting -- error message when failing to evaluate at a point is now sucky (it used to be good) to [with patch, with negative review] plotting -- error message when failing to evaluate at a point is now sucky (it used to be good)

I can't tell what the issue was or what the corrected behaviour is, BECAUSE THERE ARE NO DOCTESTS. I say do not apply.

The patch looks good, but I don't think it's been tested enough. For example, what happens if there are *no* valid data points?

comment:6 Changed 13 years ago by was

  • Milestone changed from sage-2.11 to sage-2.10.4

This must get fixed. This seems to be responsible for about 1/3 of bug/confusions on sage-support.

comment:7 Changed 13 years ago by jason

Yet another fix of this is up at #2517. The various patches should be combined into one good patch.

comment:8 Changed 13 years ago by jason

Where is the "empty_plot_list.patch" that is referred to above? Is the above plot.patch and the patch at #2517 the only patches that address this problem (and the ones that should be combined?)

comment:9 Changed 13 years ago by jason

This ticket is addressed now with #2517 and #2590 and should probably be marked a duplicate.

comment:10 Changed 13 years ago by mabshoff

  • Milestone changed from sage-2.11 to sage-duplicate/invalid
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.