Hello,

>From the sympy master, I have tried to simplify a piecewise expression 
which contains piecewise arguments:

from sympy import Piecewise, Eq, piecewise_fold
from sympy.abc import x, y

p = Piecewise((Piecewise((5, Eq(y, 0)), (2, True)), Eq(x, 0)), (Piecewise((1
, Eq(y, 0)), (6, True)), True))
print(piecewise_fold(p))

I would expect that the result has only one "Piecewise" in it, something 
like:

Piecewise((5, And(Eq(y, 0), Eq(x,0))), (2, And(True, Eq(x, 0))), (1, And(Eq(
y, 0), True)), (6, And(True, True))) # Expected result.

or, if simplified,

Piecewise((5, And(Eq(y, 0), Eq(x,0))), (2, Eq(x, 0)), (1, Eq(y, 0)), (6, 
True)) # Expected result.

But instead, the different piecewise subexpressions are not folded 
together.  Is this a bug, an unimplemented feature, or have I misunderstood 
the purpose of piecewise_fold?

Thanks,
Clayton

PS.  This testcase arose from a multiple integration which was not fully 
simplified -- so although it looks artificial, something equivalent did 
arise in actual usage.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/b98bbb19-b770-49e9-8674-cd394d3447a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to