#14037: plot of piecewise defined function raises UnboundLocalError
----------------------------+--------------------------
Reporter: slabbe | Owner: jason, was
Type: defect | Status: new
Priority: major | Milestone: sage-7.3
Component: graphics | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------+--------------------------
Changes (by mkoeppe):
* milestone: sage-6.4 => sage-7.3
Old description:
> This was reported to me by Mathieu Roux:
>
> {{{
> sage: f = piecewise([[(0,1),1],[(1,2),x-1]],x)
> sage: plot(f,0,2)
> verbose 0 (575: plot.py, plot) there were 4 extra arguments (besides
> <sage.ext.fast_eval.FastDoubleFunc object at 0xb912618>)
> ---------------------------------------------------------------------------
> UnboundLocalError Traceback (most recent call
> last)
>
> ...
>
> /Users/slabbe/Applications/sage-5.6.rc0/local/lib/python2.7/site-
> packages/sage/plot/plot.pyc in plot(funcs, *args, **kwds)
> 1117 sage.misc.misc.verbose("there were %s extra arguments
> (besides %s)" % (n, funcs), level=0)
> 1118
> -> 1119 G._set_extra_kwds(G_kwds)
> 1120 if do_show:
> 1121 G.show()
>
> UnboundLocalError: local variable 'G' referenced before assignment
> }}}
>
> It seems related to a problem cited on
> [https://groups.google.com/forum/?fromgroups=#!topic/sage-
> support/920l9d7covs sage-support] in 2008.
>
> Note that the following works:
>
> {{{
> sage: f.plot()
> }}}
New description:
This was reported to me by Mathieu Roux:
{{{
sage: f = Piecewise([[(0,1),1],[(1,2),x-1]],x)
... DeprecationWarning: use lower-case piecewise instead
sage: plot(f,0,2)
verbose 0 (575: plot.py, plot) there were 4 extra arguments (besides
<sage.ext.fast_eval.FastDoubleFunc object at 0xb912618>)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call
last)
...
/Users/slabbe/Applications/sage-5.6.rc0/local/lib/python2.7/site-
packages/sage/plot/plot.pyc in plot(funcs, *args, **kwds)
1117 sage.misc.misc.verbose("there were %s extra arguments
(besides %s)" % (n, funcs), level=0)
1118
-> 1119 G._set_extra_kwds(G_kwds)
1120 if do_show:
1121 G.show()
UnboundLocalError: local variable 'G' referenced before assignment
}}}
It seems related to a problem cited on
[https://groups.google.com/forum/?fromgroups=#!topic/sage-
support/920l9d7covs sage-support] in 2008.
Note that the following works:
{{{
sage: f.plot()
}}}
--
Comment:
Description modified. This is a bug in the old (deprecated in #14801)
`Piecewise` (capital P).
Can close this bug when the old `Piecewise` is removed completely.
--
Ticket URL: <https://trac.sagemath.org/ticket/14037#comment:6>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.