I am new to sympy but want to solve the following problem:
I have multiple inequality constraints of the form
A < f(x) < B
C < g(x) < D
...
where A, B, C, D are just numbers. f and g are rational functions.
For instance I can get the following to work:
solve_rational_inequalities([[
((Poly(x-10000.00), Poly(1, x)), '>'),
((Poly(x-100000.00), Poly(1, x)), '<'),
((Poly((x/130000.00)-0.00), Poly(1, x)), '>'),
((Poly((x/130000.00)-0.19), Poly(1, x)), '<')]])
Interval.open(10000, 24700)
Here, A = 10.000, B = 100.000, C = 0, D = 0.19, f(x) = x and g(x) = x/130.000. So this works.
Now, for another case, I have the function f(x) = 10100.00 / x.
If I just apply the recipe from above I get:
solve_rational_inequalities([[
((Poly((10100.00/x)-0.00), Poly(1, x)), '>'),
((Poly((10100.00/x)-0.19), Poly(1, x)), '<')]])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/oliverdemetz/Library/Python/2.7/lib/python/site-packages/sympy/solvers/inequalities.py", line 162, in solve_rational_inequalities
numer_intervals = solve_poly_inequality(numer*denom, rel)
File "/Users/oliverdemetz/Library/Python/2.7/lib/python/site-packages/sympy/solvers/inequalities.py", line 55, in solve_poly_inequality
reals, intervals = poly.real_roots(multiple=False), []
File "/Users/oliverdemetz/Library/Python/2.7/lib/python/site-packages/sympy/polys/polytools.py", line 3454, in real_roots
reals = sympy.polys.rootoftools.CRootOf.real_roots(f, radicals=radicals)
File "/Users/oliverdemetz/Library/Python/2.7/lib/python/site-packages/sympy/polys/rootoftools.py", line 196, in real_roots
return cls._get_roots("_real_roots", poly, radicals)
File "/Users/oliverdemetz/Library/Python/2.7/lib/python/site-packages/sympy/polys/rootoftools.py", line 565, in _get_roots
raise PolynomialError("only univariate polynomials are allowed")
sympy.polys.polyerrors.PolynomialError: only univariate polynomials are allowed