# 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


339  339  
340  340  return None 
341  341  
342   def _evalf_(self, n, x, parent=None): 
 342  def _evalf_(self, n, x, parent=None, algorithm=None): 
343  343  """ 
344  344  EXAMPLES:: 
345  345  
… 
… 

499  499  
500  500  return None # leaves the expression unevaluated 
501  501  
502   def _evalf_(self, n, x, parent=None): 
 502  def _evalf_(self, n, x, parent=None, algorithm=None): 
503  503  """ 
504  504  EXAMPLES:: 
505  505  
… 
… 

673  673  
674  674  return None # leaves the expression unevaluated 
675  675  
676   def _evalf_(self, n, x, parent=None): 
 676  def _evalf_(self, n, x, parent=None, algorithm=None): 
677  677  """ 
678  678  EXAMPLES:: 
679  679  
… 
… 

857  857  
858  858  return None # leaves the expression unevaluated 
859  859  
860   def _evalf_(self, n, x, parent=None): 
 860  def _evalf_(self, n, x, parent=None, algorithm=None): 
861  861  """ 
862  862  EXAMPLES:: 
863  863  
diff git a/sage/functions/other.py b/sage/functions/other.py
a

b


1786  1786  # or x involves an expression such as sqrt(2) 
1787  1787  return None 
1788  1788  
1789   def _evalf_(self, x, parent_d=None, algorithm=None): 
 1789  def _evalf_(self, x, parent=None, algorithm=None): 
1790  1790  """ 
1791  1791  EXAMPLES:: 
1792  1792  
… 
… 

1813  1813  sage: arg(2.0+3*i) 
1814  1814  0.982793723247329 
1815  1815  
1816   TESTS:: 
 1816  TESTS: 
1817  1817  
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 
1820  1823  """ 
1821  1824  try: 
1822  1825  return x.arg() 
1823  1826  except AttributeError: 
1824  1827  pass 
1825  1828  # 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) 
1828  1831  try: 
1829   parent_d = parent_d.complex_field() 
 1832  parent = parent.complex_field() 
1830  1833  except AttributeError: 
1831  1834  from sage.rings.complex_field import ComplexField 
1832  1835  try: 
1833   parent_d = ComplexField(x.prec()) 
 1836  parent = ComplexField(x.prec()) 
1834  1837  except AttributeError: 
1835   parent_d = ComplexField() 
 1838  parent = ComplexField() 
1836  1839  
1837   return parent_d(x).arg() 
 1840  return parent(x).arg() 
1838  1841  
1839  1842  arg=Function_arg() 
1840  1843  