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

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/d0a66ce7-d965-4810-bb33-eca9bb2bdc54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to