Could you do `print filldedent(R);print filldedent(L)` so I can see what the expressions are that you are trying to solve?
On Tuesday, December 2, 2014 8:44:33 AM UTC-6, [email protected] wrote: > > > Hi all, > > I am new to sympy (and to symbolic computations...) and I meet a problem > for solving (possibly difficult) inequalities depending upon on real > symbol > > (I have used k = symbols('k',real=True,positive=True)). > > First I build a set of (5) inequalities, stored in a list L and I want > to find > for which subset (of real numbers) they are all true. Substition for a > given value > of the symbol k works, for instance : > > for elem in L: > > print(elem.subs(k,Rational(9,4))) > > > outputs five True. But solving this way : > > > res = solve([k>2, k <= 3, L[0], L[1], L[2], L[3], L[4]], k) > > > leads to the following error: > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "/usr/lib/python2.7/site-packages/sympy/solvers/solvers.py", line > 691, in solve > > return reduce_inequalities(f, symbols=symbols) > > File "/usr/lib/python2.7/site-packages/sympy/solvers/inequalities.py", > line 513, in reduce_inequalities > > poly_reduced.append(reduce_rational_inequalities([exprs], gen)) > > File "/usr/lib/python2.7/site-packages/sympy/solvers/inequalities.py", > line 255, in reduce_rational_inequalities > > result = solution.as_relational(gen) > > File "/usr/lib/python2.7/site-packages/sympy/sets/sets.py", line 1212, in > as_relational > > return Or(*[set.as_relational(symbol) for set in self.args]) > > AttributeError: 'Complement' object has no attribute 'as_relational' > > > > From these messages, at first glance, I guessed for something wrong with > my relationals L but > > each element of L seems to have a good type: > > >>> type(L[1]) > > <class 'sympy.core.relational.StrictGreaterThan'> > > > the same than what returns: type(k>2). So I am wondering if I have made > > some mistake or if this is due to some limitations as my relations are > quite complicated : > > >>> L[1] > > 4*(-k**6 + 2*k**4 + 4*k**2 + 12)/(k*(-k**8 + 2*k**6 + 4*k**4 + 16*k**2 - > 8)) > (k**8 - 4*k**6 + 16)/(k*(k**8 - 2*k**6 - 4*k**4 - 16*k**2 + 8)) > > > Thanks for any help or advice > Bruno > > > > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/57c7bb36-50d6-4f0a-b075-f671e9391f6f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
