Ticket #8459: trac_8459-doctest.patch

File trac_8459-doctest.patch, 1.5 KB (added by burcin, 12 years ago)
  • sage/calculus/calculus.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1270464283 -7200
    # Node ID cf49a4044e23aea8cb5ecb2e460a98a533e1e65a
    # Parent  33602e16b802cf7c8b812c90fadc4178abd981bd
    trac 8459: add doctest to the polylog function to check if conversion from maxima elements works as expected.
    
    diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
    a b  
    14261426
    14271427sci_not = re.compile("(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]\d+)")
    14281428
     1429polylog_ex = re.compile('li\[([0-9]+?)\]\(')
     1430
    14291431def symbolic_expression_from_maxima_string(x, equals_sub=False, maxima=maxima):
    14301432    """
    14311433    Given a string representation of a Maxima expression, parse it and
     
    14921494                syms[X[2:]] = function_factory(X[2:])
    14931495        s = s.replace("?%","")
    14941496
    1495     regex=re.compile('li\[([0-9]+?)\]\(')
    1496     s = regex.sub('polylog(\\1,',s)
     1497    s = polylog_ex.sub('polylog(\\1,',s)
    14971498    s = multiple_replace(symtable, s)
    14981499    s = s.replace("%","")
    14991500
  • sage/functions/log.py

    diff --git a/sage/functions/log.py b/sage/functions/log.py
    a b  
    297297
    298298            sage: latex(polylog(5, x))
    299299            {\rm Li}_{5}(x)
     300
     301        TESTS:
     302
     303        Check if #8459 is fixed::
     304
     305            sage: t = maxima(polylog(5,x)).sage(); t
     306            polylog(5, x)
     307            sage: t.operator() == polylog
     308            True
     309            sage: t.subs(x=.5).n()
     310            0.508400579242269
    300311        """
    301312        GinacFunction.__init__(self, "polylog", nargs=2)
    302313