Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
18386: doctest dilog/polylog fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed May 10, 2017
1 parent 46a728a commit 51aeae3
Showing 1 changed file with 54 additions and 5 deletions.
59 changes: 54 additions & 5 deletions src/sage/functions/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,25 @@ def __init__(self):
sage: polylog(2.0, 1)
1.64493406684823
sage: polylog(2, 1.0)
NaN + NaN*I
NaN
sage: polylog(2.0, 1.0)
NaN + NaN*I
NaN
sage: BF = RealBallField(100)
sage: polylog(2, BF(1/3))
[0.3662132299770634876167462976 +/- 8.13e-29]
sage: polylog(2, BF(4/3))
nan
sage: parent(_)
Real ball field with 100 bits precision
sage: polylog(2, CBF(1/3))
[0.36621322997706 +/- 4.62e-15]
sage: parent(_)
Complex ball field with 53 bits precision
sage: polylog(2, CBF(1))
nan + nan*I
sage: parent(_)
Complex ball field with 53 bits precision
"""
GinacFunction.__init__(self, "polylog", nargs=2)

Expand Down Expand Up @@ -485,10 +501,16 @@ def __init__(self):
dilog(x^2 + 1)
sage: dilog(-1)
-1/12*pi^2
sage: dilog(-1.0)
-0.822467033424113
sage: dilog(-1.1)
-0.890838090262283
sage: float(dilog(1))
1.6449340668482262
sage: dilog(1/2)
1/12*pi^2 - 1/2*log(2)^2
sage: dilog(.5)
0.582240526465012
sage: dilog(1/2).n()
0.582240526465012
sage: var('z')
z
sage: dilog(z).diff(z, 2)
Expand All @@ -499,7 +521,19 @@ def __init__(self):
sage: latex(dilog(z))
{\rm Li}_2\left(z\right)
TESTS:
Dilog has a branch point at `1`. Sage's floating point libraries
may handle this differently from the symbolic package::
sage: dilog(1)
1/6*pi^2
sage: dilog(1.)
NaN
sage: dilog(1).n()
1.64493406684823
sage: float(dilog(1))
1.6449340668482262
TESTS:
``conjugate(dilog(x))==dilog(conjugate(x))`` unless on the branch cuts
which run along the positive real axis beginning at 1.::
Expand All @@ -518,6 +552,21 @@ def __init__(self):
dilog(-1/2*I)
sage: conjugate(dilog(2))
conjugate(dilog(2))
Check that return type matches argument type where possible
(:trac:`18386`)::
sage: dilog(0.5)
0.582240526465012
sage: dilog(-1.0)
-0.822467033424113
sage: y = dilog(RealField(13)(0.5))
sage: parent(y)
Real Field with 13 bits of precision
sage: dilog(RealField(13)(1.1))
1.96 - 0.300*I
sage: parent(_)
Complex Field with 13 bits of precision
"""
GinacFunction.__init__(self, 'dilog',
conversions=dict(maxima='li[2]'))
Expand Down

0 comments on commit 51aeae3

Please sign in to comment.