# 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
|
|
1426 | 1426 | |
1427 | 1427 | sci_not = re.compile("(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]\d+)") |
1428 | 1428 | |
| 1429 | polylog_ex = re.compile('li\[([0-9]+?)\]\(') |
| 1430 | |
1429 | 1431 | def symbolic_expression_from_maxima_string(x, equals_sub=False, maxima=maxima): |
1430 | 1432 | """ |
1431 | 1433 | Given a string representation of a Maxima expression, parse it and |
… |
… |
|
1492 | 1494 | syms[X[2:]] = function_factory(X[2:]) |
1493 | 1495 | s = s.replace("?%","") |
1494 | 1496 | |
1495 | | regex=re.compile('li\[([0-9]+?)\]\(') |
1496 | | s = regex.sub('polylog(\\1,',s) |
| 1497 | s = polylog_ex.sub('polylog(\\1,',s) |
1497 | 1498 | s = multiple_replace(symtable, s) |
1498 | 1499 | s = s.replace("%","") |
1499 | 1500 | |
diff --git a/sage/functions/log.py b/sage/functions/log.py
a
|
b
|
|
297 | 297 | |
298 | 298 | sage: latex(polylog(5, x)) |
299 | 299 | {\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 |
300 | 311 | """ |
301 | 312 | GinacFunction.__init__(self, "polylog", nargs=2) |
302 | 313 | |