Does the patch here help: http://trac.sagemath.org/ticket/15030 ?

On 12/18/2013 06:48 AM, Alden wrote:
I wrote a class with a __call__ method, and I want to plot an instance
of it using plot() in the sage notebook.  I run the commands:

import circle_homeo
import cyclic_order
h = circle_homeo.PSL2R_action(cyclic_order.CyclicOrder('abAB'))[0]

(this doesn't matter; all that should matter is that h is some callable
class)

plot(h, xmin=0, xmax=1)

returns the error:

*****************************************
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "_sage_input_32.py", line 10, in <module>
     exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("cGxvdChoLCB4bWluPTAsIHhtYXg9MSk="),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))
   File "", line 1, in <module>
   File "/tmp/tmpnBGA3K/___code___.py", line 3, in <module>
     exec compile(u'plot(h, xmin=_sage_const_0 , xmax=_sage_const_1 )
   File "", line 1, in <module>
   File
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/misc/decorators.py",
line 692, in wrapper
     return func(*args, **kwds)
   File
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/misc/decorators.py",
line 537, in wrapper
     return func(*args, **options)
   File
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/plot.py",
line 1130, in plot
     G = _plot(funcs, (xmin, xmax), **kwds)
   File
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/plot.py",
line 1236, in _plot
     funcs, ranges = setup_for_eval_on_grid(funcs, [xrange],
options['plot_points'])
   File
"/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/misc.py",
line 148, in setup_for_eval_on_grid
     return fast_float(funcs, *vars,**options),
[tuple(range+[range_step]) for range,range_step in zip(ranges, range_steps)]
   File "fast_eval.pyx", line 1377, in sage.ext.fast_eval.fast_float
(sage/ext/fast_eval.c:9718)
AttributeError: EquivariantRHomeo instance has no attribute '__float__'
*******************************************

However, if I do:

f = lambda x:h(x)
plot(f, xmin=0, xmax=1)

That works fine.  Is there something I need to do to the class to
convince plot() to call it?


--
You received this message because you are subscribed to the Google
Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to