Hi -
First time poster so sorry if this has been discussed before.
I'm having an issue with doing a series expansion of an expression with a log term in it where the argument of log is close to 1.
For instance, if I do a series expansion about an arbitrary point x0, then substitute a value for x0, it works fine. But if I instead try to do an expansion about that point directly in the series function, I can get an error for certain values.
The following gives an error on the last line, but works fine if I set, say, point = 0.49.
import sympy as sym
point = 0.491
x, x0 = sym.symbols(['x', 'x0'])
f = sym.log(x/(1-x))
print(sym.series(f, x=x, x0=x0, n=1).removeO().subs(x0, point))
print(sym.series(f, x=x, x0=point, n=1).removeO())
Is the latter not an intended way of using the series expansion functionality?
For what it's worth I tried both sympy 1.4 and 1.5.1 through Anaconda.
Here is the error:
Traceback (most recent call last):
File "sympy-bug.py", line 17, in <module>
print(sym.series(f, x=x, x0=point,n=1).removeO())
File "/apps/local/anaconda/Anaconda3-2019.10/lib/python3.7/site-packages/sympy/series/series.py", line 12, in series
return expr.series(x, x0, n, dir)
File "/apps/local/anaconda/Anaconda3-2019.10/lib/python3.7/site-packages/sympy/core/expr.py", line 2720, in series
s = self.subs(x, rep).series(x, x0=0, n=n, dir='+', logx=logx)
File "/apps/local/anaconda/Anaconda3-2019.10/lib/python3.7/site-packages/sympy/core/expr.py", line 2730, in series
rv = self.subs(x, xpos).series(xpos, x0, n, dir, logx=logx)
File "/apps/local/anaconda/Anaconda3-2019.10/lib/python3.7/site-packages/sympy/core/expr.py", line 2766, in series
% (str(n), self))
ValueError: Could not calculate 1 terms for log((_x + 0.491)/(0.509 - _x))
Any ideas? Thanks.
- Jesse