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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
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/71d2313f-5910-4d75-b9a4-6fa42c0eb5be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to