Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-23 Thread sympy
Status: New Owner: Labels: Type-Defect Priority-Medium New issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Hi, I'm new to sympy, so please forgive me if this is not a bug :-) I am trying to integrat

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-23 Thread sympy
Updates: Status: Accepted Labels: Integration Polynomial Comment #1 on issue 2128 by asmeurer: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 In master, Integral(f, (x, -oo, oo)).evalf() hangs, Integral(f, (x, -oo, oo)).d

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-23 Thread sympy
Comment #2 on issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Thank you for looking into it :) Can anything be said about when the polys11 branch gets merged in? Perhaps I could try/test the polys11 bra

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-23 Thread sympy
Comment #3 on issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 I think I found the branch at https://github.com/mattpap/sympy-polys/tree/polys11 I will test it :-) -- You received this message because y

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-23 Thread sympy
Comment #4 on issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Oops, found an error already, where can I post a bug report regarding Mateusz's polys11 branch? Should I just put it here? Just in case: a

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-23 Thread sympy
Updates: Cc: mattpap Comment #5 on issue 2128 by asmeurer: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 I can confirm that that doesn't work, and it fails regardless of the ground type. It also fails in the same way in master.

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-25 Thread sympy
Comment #6 on issue 2128 by smichr: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 nsimplify the expression with flag rational=True and all works well in master: h[7] >>> integrate(nsimplify(f, rational=1), (x, -oo, oo)).n() 1.08063375

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-27 Thread sympy
Updates: Status: Started Comment #7 on issue 2128 by mattpap: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Regarding #3, I improved domain constructor to support real numbers better, so now (in polys11) the example gives: Not

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-27 Thread sympy
Comment #8 on issue 2128 by asmeurer: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Well, that error at least needs to be improved. I can hardly understand what it is trying to say. And it uses old style "raise NotImplementedError,

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #9 on issue 2128 by mattpap: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 I hardly understand it either, hoping that this is really a NotImplementedError and not a wrong result passed to Piecewise by polys. As to those except

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #10 on issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Ok asmeurer, I will look at the code in (polys11) Piecewise._eval_interval and post back here what I've found. mattpap, great news that po

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #11 on issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 I found out why the error triggers. In Piecewise._eval_interval there is this code: if cond.args[0] == sym: curr

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #12 on issue 2128 by asmeurer: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 I think .has() is what you want, i.e., In [12]: (x - z).has(y) Out[12]: False In [13]: (x - y).has(y) Out[13]: True You can also use the in operator:

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #13 on issue 2128 by mattpap: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Actually, I'm not really sure what the difference between the two is. has() is more general than __contains__(), e.g. it works with classes: In [1]: (

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #14 on issue 2128 by jagermeistermeister: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Thanks asmeurer and mattpap, the in operator in combination with the expression is what I'm looking for :) Now I realise that I have been

Re: Issue 2128 in sympy: cannot integrate piecewise function numerically

2010-12-28 Thread sympy
Comment #15 on issue 2128 by asmeurer: cannot integrate piecewise function numerically http://code.google.com/p/sympy/issues/detail?id=2128 Maple can do it: p:=piecewise(x - y < 0, 1, 0); p := / 1 x - y < 0 {