using sympy to convert ITE to piecewise

161 views Asked by At

How do I use sympy to convert ITE to a piecewise. ITE class has _eval_rewrite_as_Piecewise(self, *args), but I am not able to figure out as to how do I use it.

I tried:

ITE(x,y,y)._eval_rewrite_as_Piecewise(x,y)

but it actually raised error. So how do I use it and what arguments should be passed as *args, or am I doing the wrong way?

1

There are 1 answers

0
smichr On

Since the answer doesn't depend on the condition, the sample you gave rides to y and there is no rewriting possible. But try ITE(x,y,z).rewite(Piecewise) to see it in action.