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 b  
    10921092        sage: f(x)=x; f
    10931093        x |--> x
    10941094        sage: plot(f,(x,-1,1))
     1095
     1096    Check that :trac:`15030` is fixed::
     1097
     1098        sage: plot(abs(log(x)), x)
    10951099    """
    10961100    G_kwds = Graphics._extract_kwds_for_show(kwds, ignore=['xmin', 'xmax'])
    10971101
  • sage/symbolic/expression.pyx

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