On Nov 18, 2010, at 1:15 PM, Mateusz Paprocki 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.
Just to be clear, the symbols == and != will not create equalities and inequalities. You will need to use Eq() and Neq() for those (see http://docs.sympy.org/dev/gotchas.html#double-equals-signs). Aaron Meurer > >> 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 at >> http://groups.google.com/group/sympy?hl=en. >> > > -- > Mateusz > -- 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.
