Hi,
I'm trying to represent a weird case using piecewise functions :
z = sympy.Piecewise((True, x>0), (False, True))
A piecewise function returning a boolean value... so far so good. The problems comes when I want to use that as a condition inside another Piecewise :
z2 = sympy.Piecewise((1,z), (0, True), evaluate=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/sympy/functions/elementary/piecewise.py", line 104, in __new__
" Boolean, or a built-in bool." % (cond, type(cond)))
TypeError: Cond Piecewise((True, x > 0), (False, True)) is of type Piecewise, but must be a Relational, Boolean, or a built-in bool.
z being obviously a boolean, is there no way for sympy to recognize that and accept it as a condition ?
Vincent