#16767: plot3d transformation crashes on functions defined using variable 't'
-------------------------+-------------------------------------------------
   Reporter:  tcoffee    |            Owner:
       Type:  defect     |           Status:  new
   Priority:  minor      |        Milestone:  sage-6.3
  Component:  graphics   |         Keywords:  plot3d transformation
  Merged in:             |  function variable
  Reviewers:             |          Authors:
Work issues:             |  Report Upstream:  N/A
     Commit:             |           Branch:
   Stopgaps:             |     Dependencies:
-------------------------+-------------------------------------------------
 The only difference between these functions is that one is defined using
 the variable {{{t}}}:

 {{{
 sage: def f(a, b): return 1
 sage: def g(a, t): return 1
 }}}

 Regular {{{plot3d}}} works fine for both:

 {{{
 sage: plot3d(f, (0, 1), (0, 1))

 sage: plot3d(g, (0, 1), (0, 1))

 }}}

 But applying a cylindrical transformation causes the second one to crash:

 {{{
 sage: S = Cylindrical('radius', ['azimuth', 'height'])
 sage: plot3d(f, (0, 2*pi), (0, 1), transformation = S)

 sage: plot3d(g, (0, 2*pi), (0, 1), transformation = S)
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)
 <ipython-input-7-919ae3065fc0> in <module>()
 ----> 1 plot3d(g, (Integer(0), Integer(2)*pi), (Integer(0), Integer(1)),
 transformation = S)

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/IPython/core/displayhook.pyc in __call__(self, result)
     236             self.start_displayhook()
     237             self.write_output_prompt()
 --> 238             format_dict = self.compute_format_data(result)
     239             self.write_format_data(format_dict)
     240             self.update_user_ns(result)

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
     148             MIME type representation of the object.
     149         """
 --> 150         return self.shell.display_formatter.format(result)
     151
     152     def write_format_data(self, format_dict):

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/IPython/core/formatters.pyc in format(self, obj, include,
 exclude)
     124                     continue
     125             try:
 --> 126                 data = formatter(obj)
     127             except:
     128                 # FIXME: log the exception

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/misc/displayhook.pyc in __call__(self, obj)
     504             sage: fmt.set_display('simple')
     505         """
 --> 506         if self.try_format_graphics(obj):
     507             return ''
     508         s = self.try_format_obj(obj)

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/misc/displayhook.pyc in try_format_graphics(self, obj)
     400         from sage.structure.sage_object import SageObject
     401         if isinstance(obj, SageObject) and hasattr(obj,
 '_graphics_'):
 --> 402             return obj._graphics_()
     403         return False
     404

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/base.so in
 sage.plot.plot3d.base.Graphics3d._graphics_
 (sage/plot/plot3d/base.c:3177)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/base.so in sage.plot.plot3d.base.Graphics3d.show
 (sage/plot/plot3d/base.c:12047)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/base.so in
 sage.plot.plot3d.base.Graphics3d._prepare_for_jmol
 (sage/plot/plot3d/base.c:8008)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/base.so in
 sage.plot.plot3d.base.Graphics3d._box_for_aspect_ratio
 (sage/plot/plot3d/base.c:8623)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/base.so in
 sage.plot.plot3d.base.Graphics3d._safe_bounding_box
 (sage/plot/plot3d/base.c:4219)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/parametric_surface.so in
 sage.plot.plot3d.parametric_surface.ParametricSurface.bounding_box
 (sage/plot/plot3d/parametric_surface.c:3529)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/parametric_surface.so in
 sage.plot.plot3d.parametric_surface.ParametricSurface.triangulate
 (sage/plot/plot3d/parametric_surface.c:4132)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/parametric_surface.so in
 sage.plot.plot3d.parametric_surface.ParametricSurface.triangulate
 (sage/plot/plot3d/parametric_surface.c:4061)()

 /usr/lib/sagemath/local/lib/python2.7/site-
 packages/sage/plot/plot3d/parametric_surface.so in
 sage.plot.plot3d.parametric_surface.ParametricSurface.eval_grid
 (sage/plot/plot3d/parametric_surface.c:5786)()

 <string> in <lambda>(a, t)

 AttributeError: 'float' object has no attribute 'subs'
 }}}

 I have not verified that this happens for other transformations, but among
 single-letter variable names, it only happens for the variable {{{t}}}.
 (Likewise for {{{cylindrical_plot3d}}}.)

--
Ticket URL: <http://trac.sagemath.org/ticket/16767>
Sage <http://www.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 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-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to