# Ticket #15030: trac15030.patch

File trac15030.patch, 2.4 KB (added by eviatarbach, 6 years ago)
• ## sage/plot/plot.py

```# HG changeset patch
# User Eviatar Bach <eviatarbach@gmail.com>
# Date 1376128485 25200
# Node ID 235c156b3faa84b95dd2420e3a4912911e4d6c65
# Parent  9d4be61466c466f0d9a39649b07036cbcd7f2a2d
Trac #15030: replace fast_float with fast_callable in 2D plotting

diff --git a/sage/plot/plot.py b/sage/plot/plot.py```
 a sage: f(x)=x; f x |--> x sage: plot(f,(x,-1,1)) Check that :trac:`15030` is fixed:: sage: plot(abs(log(x)), x) """ G_kwds = Graphics._extract_kwds_for_show(kwds, ignore=['xmin', 'xmax'])
• ## sage/symbolic/expression.pyx

`diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx`
 a A = self.variables() if len(A) == 0: #Here we handle the case where f is something #like 2*sin, which has takes arguments which #like ``sin``, which has takes arguments which #aren't explicitly given n = self.number_of_arguments() f = self._plot_fast_callable() sage: abs((I*10+1)^4) 10201 sage: plot(s) """ try: # First we try fast float.  However, this doesn't work on some # input where fast_callable works fine. return self._fast_float_(*vars) except (TypeError, NotImplementedError): # Now we try fast_callable as a fallback, since it works in some # cases when fast_float doesn't, e.g., when I is anywhere in the # expression fast_float doesn't work but fast_callable does in some # cases when the resulting expression is real. from sage.ext.fast_callable import fast_callable # I tried calling self._fast_callable_ but that's too complicated # of an interface so we just use the fast_callable function. return fast_callable(self, vars=vars) Check that :trac:`15030` is fixed:: sage: abs(log(x))._plot_fast_callable(x)(-0.2) 3.52985761682672 """ from sage.ext.fast_callable import fast_callable return fast_callable(self, vars=vars, expect_one_var=True) ############ # Calculus #