@@ -1910,7 +1910,7 @@ def exp(self, prec=infinity):
1910
1910
are not yet implemented and therefore such cases raise an error::
1911
1911
1912
1912
sage: g = 2 + f
1913
- sage: exp(g)
1913
+ sage: exp(g) # needs sage.symbolic
1914
1914
Traceback (most recent call last):
1915
1915
...
1916
1916
TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and
@@ -1920,7 +1920,7 @@ def exp(self, prec=infinity):
1920
1920
Another workaround for this limitation is to change base ring
1921
1921
to one which is closed under exponentiation, such as `\RR` or `\CC`::
1922
1922
1923
- sage: exp(g.change_ring(RDF))
1923
+ sage: exp(g.change_ring(RDF)) # needs sage.symbolic
1924
1924
7.38905609... + 7.38905609...*a + 7.38905609...*b + 3.69452804...*a^2 +
1925
1925
14.7781121...*a*b + 3.69452804...*b^2 + O(a, b)^3
1926
1926
@@ -2003,7 +2003,7 @@ def log(self, prec=infinity):
2003
2003
are not yet implemented and therefore such cases raise an error::
2004
2004
2005
2005
sage: g = 2 + f
2006
- sage: log(g)
2006
+ sage: log(g) # needs sage.symbolic
2007
2007
Traceback (most recent call last):
2008
2008
...
2009
2009
TypeError: unsupported operand parent(s) for -: 'Symbolic Ring' and 'Power
@@ -2012,7 +2012,7 @@ def log(self, prec=infinity):
2012
2012
Another workaround for this limitation is to change base ring
2013
2013
to one which is closed under exponentiation, such as `\RR` or `\CC`::
2014
2014
2015
- sage: log(g.change_ring(RDF))
2015
+ sage: log(g.change_ring(RDF)) # needs sage.symbolic
2016
2016
1.09861228... + 0.333333333...*a + 0.333333333...*b - 0.0555555555...*a^2
2017
2017
+ 0.222222222...*a*b - 0.0555555555...*b^2 + 0.0123456790...*a^3
2018
2018
- 0.0740740740...*a^2*b - 0.0740740740...*a*b^2 + 0.0123456790...*b^3
@@ -2039,11 +2039,14 @@ def log(self, prec=infinity):
2039
2039
R = self .parent ()
2040
2040
Rbg = R ._bg_power_series_ring
2041
2041
2042
- from sage .functions .log import log
2043
2042
c = self .constant_coefficient ()
2044
2043
if c .is_zero ():
2045
2044
raise ValueError ('Can only take formal power series for non-zero constant term.' )
2046
- log_c = log (c )
2045
+ if c .is_one ():
2046
+ log_c = self .base_ring ().zero ()
2047
+ else :
2048
+ from sage .functions .log import log
2049
+ log_c = log (c )
2047
2050
x = 1 - self ._bg_value / c
2048
2051
if x .is_zero ():
2049
2052
return log_c
0 commit comments