Ticket #5777: trac_5777-14-exp.patch

File trac_5777-14-exp.patch, 1.1 KB (added by burcin, 11 years ago)

doctests for the changes in behavior of exp

  • sage/symbolic/expression.pyx

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1241564869 -7200
    # Node ID 14f93946187a509754ba12be3124d64df69b4b2e
    # Parent  012d71daae6bd233cc39a5c0ab69ddba6ec294b0
    Add doctests to test that
     - the exp function in pynac doesn't print the exponent if it is equal to 1.
     - powers of the exp function are handled properly, i.e. (e^x)^y -> e^(x*y)
    
    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    261261            -I
    262262            sage: y + 3*(x^(-1))
    263263            y + 3/x
     264
     265        Printing the exp function::
     266       
     267            sage: x.parent(1).exp()
     268            e
     269            sage: x.exp()
     270            e^x
    264271        """
    265272        return GEx_to_str(&self._gobj)
    266273
     
    13211328            -Infinity
    13221329            sage: S(unsigned_infinity)^2
    13231330            Infinity
     1331
     1332        Test powers of exp::
     1333           
     1334            sage: S(2).exp()^5
     1335            e^10
     1336            sage: x.exp()^5
     1337            e^(5*x)
    13241338        """
    13251339        cdef Expression nexp = self.coerce_in(exp)
    13261340        cdef GEx x