Ticket #12950: trac_12950-pynac_infinities_doctest_fixes.patch

File trac_12950-pynac_infinities_doctest_fixes.patch, 8.7 KB (added by burcin, 8 years ago)
  • sage/functions/other.py

    # HG changeset patch
    # User Volker Braun <vbraun@stp.dias.ie>
    # Date 1337093612 -7200
    # Node ID 7d14009cc1693eaeabeb27ca4e955a512fe8b8e6
    # Parent  765a4b54b75306e2e72c2a44c751025eb06b8ec3
    Fix doctests after infinities rewrite in Pynac.
    
    diff --git a/sage/functions/other.py b/sage/functions/other.py
    a b  
    791791            sage: log_gamma(-2)
    792792            +Infinity
    793793            sage: conjugate(log_gamma(-2))
    794             conjugate(+Infinity)
     794            +Infinity
    795795        """
    796796        GinacFunction.__init__(self, "log_gamma", latex_name=r'\log\Gamma',
    797797                conversions={'mathematica':'LogGamma','maxima':'log_gamma'})
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    207207
    208208        OUTPUT:
    209209
    210         The python object corresponding to this expression, assuming
    211         this expression is a single numerical value. Otherwise, a
    212         TypeError is raised.
     210        The Python object corresponding to this expression, assuming
     211        this expression is a single numerical value or an infinity
     212        representable in Python. Otherwise, a ``TypeError`` is raised.
    213213
    214214        EXAMPLES::
    215215       
     
    233233            sage: SR(I*oo).pyobject()
    234234            Traceback (most recent call last):
    235235            ...
    236             ValueError: Python infinity cannot have complex phase.
     236            TypeError: Python infinity cannot have complex phase.
    237237        """
    238238        cdef GConstant* c
    239239        if is_a_constant(self._gobj):
     
    22482248            sage: nsr(oo) - nsr(oo)
    22492249            Traceback (most recent call last):
    22502250            ...
    2251             RuntimeError: indeterminate expression: Infinity - Infinity encountered.
     2251            RuntimeError: indeterminate expression: infinity - infinity encountered.
    22522252            sage: nsr(-oo) - nsr(-oo)
    22532253            Traceback (most recent call last):
    22542254            ...
    2255             RuntimeError: indeterminate expression: Infinity - Infinity encountered.
     2255            RuntimeError: indeterminate expression: infinity - infinity encountered.
    22562256
    22572257            sage: nsr(unsigned_infinity) + nsr(oo)
    22582258            Traceback (most recent call last):
    22592259            ...
    2260             RuntimeError: indeterminate expression: unsigned_infinity + x where x is Infinity, -Infinity or unsigned infinity encountered.
     2260            RuntimeError: indeterminate expression: unsigned_infinity +- infinity encountered.
    22612261            sage: nsr(unsigned_infinity) - nsr(oo)
    22622262            Traceback (most recent call last):
    22632263            ...
    2264             RuntimeError: indeterminate expression: unsigned_infinity + x where x is Infinity, -Infinity or unsigned infinity encountered.
     2264            RuntimeError: indeterminate expression: unsigned_infinity +- infinity encountered.
    22652265            sage: nsr(oo) + nsr(unsigned_infinity)
    22662266            Traceback (most recent call last):
    22672267            ...
    2268             RuntimeError: indeterminate expression: unsigned_infinity + x where x is Infinity, -Infinity or unsigned infinity encountered.
     2268            RuntimeError: indeterminate expression: unsigned_infinity +- infinity encountered.
    22692269            sage: nsr(oo) - nsr(unsigned_infinity)
    22702270            Traceback (most recent call last):
    22712271            ...
    2272             RuntimeError: indeterminate expression: unsigned_infinity + x where x is Infinity, -Infinity or unsigned infinity encountered.
     2272            RuntimeError: indeterminate expression: unsigned_infinity +- infinity encountered.
    22732273            sage: nsr(unsigned_infinity) + nsr(unsigned_infinity)
    2274             Traceback (most recent call last):
    2275             ...
    2276             RuntimeError: indeterminate expression: unsigned_infinity + x where x is Infinity, -Infinity or unsigned infinity encountered.
    2277 
    2278 
     2274            Infinity
    22792275        """
    22802276        cdef GEx x
    22812277        cdef Expression _right = <Expression>right
     
    24312427        ::
    24322428
    24332429            sage: x*oo
    2434             +Infinity
    2435             sage: -x*oo
    2436             -Infinity
     2430            Traceback (most recent call last):
     2431            ...
     2432            ArithmeticError: indeterminate expression: infinity * f(x) encountered.
    24372433            sage: x*unsigned_infinity
    24382434            Traceback (most recent call last):
    24392435            ...
     
    25062502            sage: x/oo
    25072503            0
    25082504            sage: oo/x
    2509             +Infinity
     2505            Traceback (most recent call last):
     2506            ...
     2507            RuntimeError: indeterminate expression: infinity * f(x) encountered.
    25102508
    25112509            sage: SR(oo)/SR(oo)
    25122510            Traceback (most recent call last):
    25132511            ...
    2514             RuntimeError: indeterminate expression: 0*infinity encountered.
     2512            RuntimeError: indeterminate expression: 0 * infinity encountered.
    25152513
    25162514            sage: SR(-oo)/SR(oo)
    25172515            Traceback (most recent call last):
    25182516            ...
    2519             RuntimeError: indeterminate expression: 0*infinity encountered.
     2517            RuntimeError: indeterminate expression: 0 * infinity encountered.
    25202518
    25212519            sage: SR(oo)/SR(-oo)
    25222520            Traceback (most recent call last):
    25232521            ...
    2524             RuntimeError: indeterminate expression: 0*infinity encountered.
     2522            RuntimeError: indeterminate expression: 0 * infinity encountered.
    25252523
    25262524            sage: SR(oo)/SR(unsigned_infinity)
    25272525            Traceback (most recent call last):
    25282526            ...
    2529             RuntimeError: indeterminate expression: 0*infinity encountered.
     2527            RuntimeError: indeterminate expression: 0 * infinity encountered.
    25302528
    25312529            sage: SR(unsigned_infinity)/SR(oo)
    25322530            Traceback (most recent call last):
    25332531            ...
    2534             RuntimeError: indeterminate expression: 0*infinity encountered.
     2532            RuntimeError: indeterminate expression: 0 * infinity encountered.
    25352533
    25362534            sage: SR(0)/SR(oo)
    25372535            0
     
    26762674            sage: x^oo
    26772675            Traceback (most recent call last):
    26782676            ...
    2679             ValueError: power::eval(): pow(x, Infinity) for non numeric x is not defined.
     2677            ValueError: power::eval(): pow(f(x), infinity) is not defined.
    26802678            sage: SR(oo)^2
    26812679            +Infinity
    26822680            sage: SR(-oo)^2
     
    35763574            sage: (x/y).subs(y=oo)
    35773575            0
    35783576            sage: (x/y).subs(x=oo)
    3579             +Infinity
     3577            Traceback (most recent call last):
     3578            ...
     3579            RuntimeError: indeterminate expression: infinity * f(x) encountered.
    35803580            sage: (x*y).subs(x=oo)
    3581             +Infinity
     3581            Traceback (most recent call last):
     3582            ...
     3583            RuntimeError: indeterminate expression: infinity * f(x) encountered.
    35823584            sage: (x^y).subs(x=oo)
    35833585            Traceback (most recent call last):
    35843586            ...
    3585             ValueError: power::eval(): pow(Infinity, x) for non numeric x is not defined.
     3587            ValueError: power::eval(): pow(Infinity, f(x)) is not defined.
    35863588            sage: (x^y).subs(y=oo)
    35873589            Traceback (most recent call last):
    35883590            ...
    3589             ValueError: power::eval(): pow(x, Infinity) for non numeric x is not defined.
     3591            ValueError: power::eval(): pow(f(x), infinity) is not defined.
    35903592            sage: (x+y).subs(x=oo)
    35913593            +Infinity
    35923594            sage: (x-y).subs(y=oo)
     
    57225724            sage: SR(1).arctan2(CDF(0,1))
    57235725            arctan2(1, 1.0*I)
    57245726
     5727            sage: arctan2(0,oo)                       
     5728            0
    57255729            sage: SR(oo).arctan2(oo)
    5726             Traceback (most recent call last):
    5727             ...
    5728             RuntimeError: arctan2_eval(): arctan2(infinity, infinity) encountered
     5730            1/4*pi
    57295731            sage: SR(oo).arctan2(0)
    5730             0
     5732            1/2*pi
    57315733            sage: SR(-oo).arctan2(0)
     5734            -1/2*pi
     5735            sage: SR(-oo).arctan2(-2)
    57325736            pi
    5733             sage: SR(-oo).arctan2(-2)
    5734             -pi
    57355737            sage: SR(unsigned_infinity).arctan2(2)
    57365738            Traceback (most recent call last):
    57375739            ...
    5738             RuntimeError: arctan2_eval(): arctan2(unsigned_infinity, x) encountered
     5740            RuntimeError: arctan2_eval(): arctan2(x, unsigned_infinity) encountered
    57395741            sage: SR(2).arctan2(oo)
    57405742            1/2*pi
    57415743            sage: SR(2).arctan2(-oo)
     
    57435745            sage: SR(2).arctan2(SR(unsigned_infinity))
    57445746            Traceback (most recent call last):
    57455747            ...
    5746             RuntimeError: arctan2_eval(): arctan2(x, unsigned_infinity) encountered
     5748            RuntimeError: arctan2_eval(): arctan2(unsigned_infinity, x) encountered
    57475749        """
    57485750        cdef Expression nexp = self.coerce_in(x)
    57495751        return new_Expression_from_GEx(self._parent,