Ticket #12289: trac_12289-last_touches.patch

File trac_12289-last_touches.patch, 3.0 KB (added by burcin, 6 years ago)
  • sage/functions/bessel.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1371672866 -7200
    #      Wed Jun 19 22:14:26 2013 +0200
    # Node ID a53baafb87005bb28a7c86292337784faf77635f
    # Parent  9f047cf2c3a34ef9c6141b602a0c523226aaeb25
    trac 12289: fix random issues caused by _evalf_ convention change
    
    This patch fixes 2 issues:
    
    - add algorithm=None arguments to _evalf_ methods defined in
      sage/functions/bessel.py
    
    - fix _evalf_ method of sage.functions.other.arg()
    
      Apparently this function was never tested when the parent keyword argument
      is specified.
    
    diff --git a/sage/functions/bessel.py b/sage/functions/bessel.py
    a b  
    339339
    340340        return None
    341341
    342     def _evalf_(self, n, x, parent=None):
     342    def _evalf_(self, n, x, parent=None, algorithm=None):
    343343        """
    344344        EXAMPLES::
    345345
     
    499499
    500500        return None  # leaves the expression unevaluated
    501501
    502     def _evalf_(self, n, x, parent=None):
     502    def _evalf_(self, n, x, parent=None, algorithm=None):
    503503        """
    504504        EXAMPLES::
    505505
     
    673673
    674674        return None  # leaves the expression unevaluated
    675675
    676     def _evalf_(self, n, x, parent=None):
     676    def _evalf_(self, n, x, parent=None, algorithm=None):
    677677        """
    678678        EXAMPLES::
    679679
     
    857857
    858858        return None  # leaves the expression unevaluated
    859859
    860     def _evalf_(self, n, x, parent=None):
     860    def _evalf_(self, n, x, parent=None, algorithm=None):
    861861        """
    862862        EXAMPLES::
    863863
  • sage/functions/other.py

    diff --git a/sage/functions/other.py b/sage/functions/other.py
    a b  
    17861786            # or x involves an expression such as sqrt(2)
    17871787            return None
    17881788
    1789     def _evalf_(self, x, parent_d=None, algorithm=None):
     1789    def _evalf_(self, x, parent=None, algorithm=None):
    17901790        """
    17911791        EXAMPLES::
    17921792
     
    18131813            sage: arg(2.0+3*i)
    18141814            0.982793723247329
    18151815
    1816         TESTS::
     1816        TESTS:
    18171817
    1818             sage: C = arg(5+I)
    1819             sage: C.n()
     1818        Make sure that the ``_evalf_`` method works when it receives a
     1819        keyword argument ``parent`` :trac:`12289`::
     1820
     1821            sage: arg(5+I, hold=True).n()
     1822            0.197395559849881
    18201823        """
    18211824        try:
    18221825            return x.arg()
    18231826        except AttributeError:
    18241827            pass
    18251828        # try to find a parent that support .arg()
    1826         if parent_d is None:
    1827             parent_d = s_parent(x)
     1829        if parent is None:
     1830            parent = s_parent(x)
    18281831        try:
    1829             parent_d = parent_d.complex_field()
     1832            parent = parent.complex_field()
    18301833        except AttributeError:
    18311834            from sage.rings.complex_field import ComplexField
    18321835            try:
    1833                 parent_d = ComplexField(x.prec())
     1836                parent = ComplexField(x.prec())
    18341837            except AttributeError:
    1835                 parent_d = ComplexField()
     1838                parent = ComplexField()
    18361839
    1837         return parent_d(x).arg()
     1840        return parent(x).arg()
    18381841
    18391842arg=Function_arg()
    18401843