I observe following behavior: In [113]: solve([Le((-1 + x),(-2 + x+x**3)), Assume(x,Q.real)], x, relational=False) Out[113]: [[1, ∞)] In [114]: solve([Le((-1 + x)/(-2 + x+x**3),1), Assume(x,Q.real)], x, relational=False) NotImplementedError (...)
But there is a workaround: one must put the denominators to the second side, observing their sign. This requires to write some useful (but probably missing) routines, so it will take me a while. I will post an example soon. This will be a step forward from polynomials. Many more expressions in real life can be simplified to a single fraction using together(). Btw: maybe the function should behave as if relational was set to False by default; what do you think? On Nov 18, 9:15 pm, Mateusz Paprocki <[email protected]> wrote: > Hi, > > > > > > > > > > On Thu, Nov 18, 2010 at 11:51:59AM -0800, Filip Dominec wrote: > > > On Nov 18, 7:02 pm, Mateusz Paprocki <[email protected]> wrote: > > > it can be easily extended > > > to support rational functions and absolute values (somewhere I have > > > preliminary code for this). > > > Cool. Right now I am using sympy to solve some calculations for > > geometrical optics. These problems boiled down to a system of rational > > equations with several variables. However, there are also several > > constraints which would be handled the most efficient way if I could > > simply calculate intersection of all the intervals for which the > > inequalities hold. > > > This is my motivation to use the inequality solver. I would be happy > > if I could get the fresh version from git, test it on a real problem > > and report how it works. > > > > I think it shouldn't be very hard to write a function for > > > converting relational to interval form (where it makes sense). > > > I expect it would not be hard, but I have not oriented in the code yet > > to try it myself. > > Actually, it is possible to get intervals, you just need to set > 'relational' flag to False, e.g.: > > In [1]: ieqs = [(x-1)*(x-2)*(x-3) >= 0, (x+1)*(x-2) >= 0] > > In [2]: solve(ieqs + [Assume(x, Q.real)], x, relational=False) > Out[2]: [{2}, [3, ∞)] > > As you can see solve() can handle systems of inequalities (allowed > operators are ==, !=, >, >=, <, <=). The inequality solver is run > when at least one relational operator is encountered. If you set > relational=False together with a complex variable, then you will > get the result in relational form anyway. > > > Filip > > > -- > > You received this message because you are subscribed to the Google Groups > > "sympy" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/sympy?hl=en. > > -- > Mateusz > > signature.asc > < 1KViewDownload -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
