New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError on function_range
of Abs(((log(x))**Rational(1, 3)))
#26518
Comments
Other example (with different error) from sympy import Symbol, Abs, Rational, log, Interval
from sympy.calculus.util import function_range
x = Symbol('x', real=True)
func_expr = log(1+x)/(x**(Rational(1, 3))*(2+x))
function_range(func_expr, x, Interval.Lopen(0, 1))
Traceback (most recent call last):
File "sympy/calculus/util.py", line 197, in function_range
solution = solveset(f.diff(symbol), symbol, interval)
File "sympy/solvers/solveset.py", line 2252, in solveset
rv = solveset(f.xreplace({symbol: x}), x, domain)
File "sympy/solvers/solveset.py", line 2276, in solveset
return _solveset(f, symbol, domain, _check=True)
File "sympy/solvers/solveset.py", line 1148, in _solveset
_result = _solveset(num, symbol, domain)
File "sympy/solvers/solveset.py", line 1106, in _solveset
result += _solve_radical(equation, u,
File "sympy/solvers/solveset.py", line 879, in _solve_radical
result = Union(*[imageset(Lambda(y, g_y), f_y_sols)
File "sympy/solvers/solveset.py", line 879, in <listcomp>
result = Union(*[imageset(Lambda(y, g_y), f_y_sols)
File "sympy/sets/sets.py", line 1561, in __iter__
raise TypeError(
TypeError: The computation had not completed because of the undecidable set membership is found in every candidates. |
The first issue is the naive implementation of The second case is just a bug in solveset although it is related to the problem of solveset output being hard to use: even solveset itself struggles to use its own intermediate results. |
@oscarbenjamin Is there anything that should be done here? I'd like to contribute |
The simple fix in each case is just to add some checking somewhere. If you check in the debugger for the second bug you can see this: sympy/sympy/solvers/solveset.py(1106)_solve_radical()
1104 g_y_s = solveset_solver(yeq, symbol)
1105 f_y_sols = solveset_solver(eq, y)
-> 1106 result = Union(*[imageset(Lambda(y, g_y), f_y_sols)
1107 for g_y in g_y_s])
1108
ipdb> p g_y_s
Intersection({_yreal**3}, Interval.Lopen(0, 1)) It is trying to loop over There are all kinds of other problems though like why is there a symbol called solveset(f.diff(symbol), symbol, interval) is hopelessly naive. |
But if i change
sympy/sympy/calculus/util.py
Line 265 in af0c855
to
— it work fine
The text was updated successfully, but these errors were encountered: