Attachment 'erf0.patch'

Download

   1 # HG changeset patch
   2 # User Ross Kyprianou <[email protected]>
   3 # Date 1273850198 -34200
   4 # Node ID 0d75eeb0ff901b765402811dc9e511ac2f21fdae
   5 # Parent  b052a914e445de73b2fc9c1356606479a917316c
   6 Trac 8983: erf(0) should return 0
   7 
   8 diff -r b052a914e445 -r 0d75eeb0ff90 sage/functions/other.py
   9 --- a/sage/functions/other.py
  10 +++ b/sage/functions/other.py
  11 @@ -24,7 +24,6 @@
  12  one_half = ~SR(2)
  13  
  14  class Function_erf(BuiltinFunction):
  15 -    _eval_ = BuiltinFunction._eval_default
  16      def __init__(self):
  17          r"""
  18          The error function, defined as
  19 @@ -39,6 +38,8 @@
  20              erf(2)
  21              sage: erf(2).n()
  22              0.995322265018953
  23 +            sage: erf(0)
  24 +            0.0
  25              sage: loads(dumps(erf))
  26              erf
  27  
  28 @@ -60,6 +61,17 @@
  29          """
  30          BuiltinFunction.__init__(self, "erf", latex_name=r"\text{erf}")
  31  
  32 +    def _eval_(self, x):
  33 +        """
  34 +        EXAMPLES::
  35 +
  36 +            sage: erf(0)
  37 +            0.0
  38 +        """
  39 +        if x.is_zero():
  40 +            return 0.0
  41 +        return BuiltinFunction._eval_default(self, x)
  42 +
  43      def _evalf_(self, x, parent=None):
  44          """
  45          EXAMPLES::

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-05-28 12:36:02, 1.1 KB) [[attachment:erf0.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.