Re: [sympy] difference between None and []

2010-11-24 Thread Aaron S. Meurer
There was some discussion of this over at http://code.google.com/p/sympy/issues/detail?id=2009. Aaron Meurer On Nov 24, 2010, at 9:04 PM, smichr wrote: > sometimes solve returns None and sometimes it returns []. Is there any > reason that a None would be preferred to []? > > -- > You received

[sympy] difference between None and []

2010-11-24 Thread smichr
sometimes solve returns None and sometimes it returns []. Is there any reason that a None would be preferred to []? -- 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 gr

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

[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-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

[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
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
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