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

Commit

Permalink
21429: fix doctest fails
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Jan 15, 2017
1 parent 95e8048 commit 2ded570
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/sage/probability/random_variable.py
Expand Up @@ -315,8 +315,8 @@ def __init__(self, X, P, codomain = None, check = False):
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
sage: X.set()
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
sage: X.entropy()
1.999725341796875
sage: X.entropy().n()
1.99972534179688
A probability space can be defined on any list of elements::
Expand All @@ -326,8 +326,8 @@ def __init__(self, X, P, codomain = None, check = False):
sage: X = DiscreteProbabilitySpace(S,P)
sage: X
Discrete probability space defined by {'A': 1/2, 'C': 1/4, 'B': 1/4}
sage: X.entropy()
1.5
sage: X.entropy().n()
1.50000000000000
"""
if codomain is None:
codomain = RealField()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/power_series_ring_element.pyx
Expand Up @@ -1855,7 +1855,7 @@ cdef class PowerSeries(AlgebraElement):
sage: (-1 + t + O(t^10)).log()
Traceback (most recent call last):
...
AttributeError: 'sage.rings.rational.Rational' object has no attribute 'log'
ArithmeticError: constant term of power series is not 1
sage: R.<t> = PowerSeriesRing(RR)
sage: (2+t).log().exp()
Expand All @@ -1868,7 +1868,7 @@ cdef class PowerSeries(AlgebraElement):
const_off = zero

if not self[0].is_one():
if self.base_ring() in _Fields:
if self.base_ring() in _Fields and self[0] > 0:
const_off = self[0].log()
else:
raise ArithmeticError("constant term of power series is not 1")
Expand Down
4 changes: 2 additions & 2 deletions src/sage/symbolic/expression.pyx
Expand Up @@ -1243,13 +1243,13 @@ cdef class Expression(CommutativeRingElement):
sage: t = log(10); t
log(10)
sage: t._convert({'parent':QQ})
sage: t._convert({'parent':ZZ})
2.30258509299405
::
sage: (0.25 / (log(5.74 /x^0.9, 10))^2 / 4)._convert({'parent':QQ})
0.331368631904900/log(287/50/x^0.900000000000000)^2
1/16*log(10)^2/log(287/50/x^0.900000000000000)^2
sage: (0.25 / (log(5.74 /x^0.9, 10))^2 / 4)._convert({'parent':CC})
0.331368631904900/log(5.74000000000000/x^0.900000000000000)^2
Expand Down

0 comments on commit 2ded570

Please sign in to comment.