#6947: [with patch, needs review] make complex_plot() work for for fast_callable
functions
----------------------+-----------------------------------------------------
Reporter: bober | Owner: was
Type: defect | Status: new
Priority: minor | Milestone: sage-4.1.2
Component: graphics | Keywords:
Reviewer: | Author: Bober
Merged: |
----------------------+-----------------------------------------------------
This current behavior of Sage demonstrates a bug, which probably also
affects other complex valued functions that cannot be converted into real
valued functions.
{{{
sage: f(x) = x^2
sage: g = fast_callable(f, domain=CC, vars='x')
sage: P = complex_plot(f, (-10, 10), (-10, 10))
sage: Q = complex_plot(g, (-10, 10), (-10, 10))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (35, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/bober/.sage/temp/bober/1740/_home_bober__sage_init_sage_0.py in
<module>()
/home/bober/sage/local/lib/python2.6/site-packages/sage/plot/misc.pyc in
wrapper(*args, **kwds)
133 options['__original_opts'] = kwds
134 options.update(kwds)
--> 135 return func(*args, **options)
136
137
/home/bober/sage/local/lib/python2.6/site-
packages/sage/plot/complex_plot.so in sage.plot.complex_plot.complex_plot
(sage/plot/complex_plot.c:4104)()
/home/bober/sage/local/lib/python2.6/site-packages/sage/plot/plot.pyc in
setup_for_eval_on_grid(v, xrange, yrange, plot_points)
2874 from sage.plot.plot3d.parametric_plot3d import
adapt_to_callable
2875 if xvar is None:
-> 2876 k, _ = adapt_to_callable([f], 2)
2877 g.append(k[0])
2878 else:
/home/bober/sage/local/lib/python2.6/site-
packages/sage/plot/plot3d/parametric_plot3d.pyc in adapt_to_callable(f,
nargs)
649 except TypeError:
650 vars = ()
--> 651 f = [fast_float_constant(x) for x in f]
652
653 if nargs is not None and len(vars) != nargs:
/home/bober/sage/local/lib/python2.6/site-packages/sage/ext/fast_eval.so
in sage.ext.fast_eval.fast_float_constant (sage/ext/fast_eval.c:8030)()
/home/bober/sage/local/lib/python2.6/site-packages/sage/ext/fast_eval.so
in sage.ext.fast_eval.FastDoubleFunc.__init__
(sage/ext/fast_eval.c:3492)()
TypeError: a float is required
}}}
The attached patch fixes this. (It is a one character fix, but someone who
knows the plotting code should make sure it is the right fix.)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6947>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---