[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-17 Thread Filip Dominec
Thank you, this version works. (Now I have to find out to which extent the inequalities can be solved; it seems to me that many functions have to be converted to MacLaurin series before. Moreover, it would be handy to convert inequalities to an interval.) -- You received this message because you

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-18 Thread Mateusz Paprocki
Hi, On 18 November 2010 08:03, Filip Dominec wrote: > Thank you, this version works. (Now I have to find out to which extent > the inequalities can be solved; it seems to me that many functions > have to be converted to MacLaurin series before. Moreover, it would be > handy to convert inequaliti

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-18 Thread Filip Dominec
On Nov 18, 7:02 pm, Mateusz Paprocki 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

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-19 Thread Chris Smith
>> I don't see 1694B there, only 1694 and 1694cov. >> Sorry. It's there now. /c -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubsc

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Filip Dominec
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 th

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Filip Dominec
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 th

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Filip Dominec
I am working on a new solve() routine to fix the issue discussed in my previous post. However, I observed a bug (?) that sticks deep in the code. I am using the "git clone https://matt...@github.com/mattpap/sympy-polys.git; cd sympy-polys ; git checkout polys11" version. In [388]: solve([Le(3,

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Filip Dominec
Now it is possible to calculate for example this: In [451]: SolveFractionIeq((2*x-1)/(x-1), (2*x-1)/x, x) Out[451]: [[1/2, 1], (-∞, 0]] ... which is almost correct if we omit the closedness of intervals (somebody fixes?). Note that the aforementioned UnboundLocalError in inequalities.py prevents

[sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Filip Dominec
If I can contribute to the discussion, I support the simpler behavior when Le(3,4) stays as a inequation until it has to be evaluated. Not only the shortcut to True/False has now proven to bring in an error in the solving routine, it is possible that in some situation one will want to extract the l

Re: [sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-18 Thread Mateusz Paprocki
Hi, On Thu, Nov 18, 2010 at 11:51:59AM -0800, Filip Dominec wrote: > > > On Nov 18, 7:02 pm, Mateusz Paprocki 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 sol

Re: [sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-18 Thread Aaron S. Meurer
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 wrote: >>> it can be easily extended >>> to support rational functions and absolute values (somewhere I have >>> prelimin

Re: [sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-18 Thread Chris Smith
Filip Dominec wrote: > On Nov 18, 7:02 pm, Mateusz Paprocki 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 pro

Re: [sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-19 Thread Mateusz Paprocki
Hi, On 19 November 2010 02:13, Chris Smith wrote: > Filip Dominec wrote: > > On Nov 18, 7:02 pm, Mateusz Paprocki 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 sy

Re: [sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Aaron Meurer
Perhaps it has something to do with solve not taking into account that Le() and friends evaluate themselves to a boolean in trivial cases: In [1]: Le(3,4) Out[1]: True But the only way to really know for sure is to debug the code. By the way, there's been some debate before on whether or not it

Re: [sympy] Re: Solving inequality (e. g. "x**2<=2")

2010-11-24 Thread Aaron Meurer
I agree. If anything, I think we may need to have separate classes to represent a < b the inequality and a < b the boolean. One problem with Le(3, 4) not returning True is that constructs like if a < b: do something will break if a or b are sympified, because a < b returns Lt(a, b) in that c