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 integrate the following Piecewise function over the interval [-oo. oo]:

f = 0.0032513612725229*Piecewise((0, x < -80.8461538461539), (1.33215984776403 - 0.0160799238820171*x, x < 2), (Piecewise((0.4, 2 < x), (0.6, 1)) + Piecewise((0.3, 123 < x), (0.7, 1)), x <= 123), (2.10541401273885 - 0.00817409766454352*x, x < 380.571428571429), (0, 1))

In pretty print it looks like this:

0.0032513612725229⋅⎧ 0 for x < -80.8461538461539
⎪1.33215984776403 - 0.0160799238820171⋅x for x < 2
⎪ ⎧0.4 for 2 < x + ⎧0.3 for 123 < x for x ≤ 123
                   ⎨  ⎨                 ⎨
                   ⎪  ⎩0.6  otherwise   ⎩0.7   otherwise
                   ⎪
⎪2.10541401273885 - 0.00817409766454352⋅x for x < 380.571428571429
⎩ 0 otherwise

I expect the result to be a number, but it returns the following (command: sympy.integrate(f, (x, -oo, oo)) ):

∞
⌠
⎮ 0.0032513612725229⋅x⋅⎧ 0 for x < -80.8461538461539 dx
⎮                       ⎪
⎮ ⎪1.33215984776403 - 0.0160799238820171⋅x for x < 2
⎮                       ⎪
⎮ ⎪ ⎧0.4 for 2 < x + ⎧0.3 for 123 < x for x ≤ 123
⎮                       ⎨  ⎨                 ⎨
⎮                       ⎪  ⎩0.6  otherwise   ⎩0.7   otherwise
⎮                       ⎪
⎮ ⎪2.10541401273885 - 0.00817409766454352⋅x for x < 380.571428571429
⎮                       ⎪
⎮ ⎩ 0 otherwise
⌡
-∞
Which is the same function as I passed to integrate(), but with an integral sign in front of it :)

Also, it takes quite a long time for it to give that answer, it takes about 1 second.

If this is a bug, I'm willing to help fix it. I'd need some directions, though. I'm new to sympy and python. :) (no experience with git yet either!)

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en.

Reply via email to