Currently, indefinite integration of Piecewise gives the discontinuous Piecewise result obtained by simply integrating the pieces of the Piecewise. I propose (in PR #12587) that the `integrate` method give the continuous result and a method `piecewise_integrate` be used to return the old behavior. Are there other ideas? Do we need a deprecation of the old behavior?
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/95872e1e-ac0e-4b3d-b1c2-43520fa88158%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
>>> var('A:C')
(A, B, C)
>>> i = Piecewise((A, x<1), (B, x>2), (C, True)).integrate(x); i # new continuous result
Piecewise((A*x, x <= 1), (A + C*x - C, x <= 2), (A + B*x - 2*B + C, True))
>>> for j in range(0,6):
... j,i.subs(x,j)
...
(0, 0)
(1, A)
(2, A + C)
(3, A + B + C)
(4, A + 2*B + C)
(5, A + 3*B + C)
>>> pwi = Piecewise((A, x<1), (B, x>2), (C, True)).piecewise_integrate(x) # old discontinuous result
>>> pwi
Piecewise((A*x, x < 1), (B*x, x > 2), (C*x, True))
>>> for j in range(0,6):
... j,pwi.subs(x,j)
...
(0, 0)
(1, C)
(2, 2*C)
(3, 3*B)
(4, 4*B)
(5, 5*B)