You are looking for Piecewise. Piecewise((x, cond), (y, True)) is the same as ITE(cond, x, y), only it acts as an expression (you can add it and so on), not a boolean.
Aaron Meurer On Fri, Apr 4, 2014 at 11:16 PM, SAHIL SHEKHAWAT <[email protected] > wrote: > Still i emphasis on the fact that i am not that much experienced you can > wait for other experienced developers to reply or you can also join us on > gitter. https://gitter.im/sympy/sympy > > > On Friday, April 4, 2014 9:23:56 PM UTC+5:30, Mehul Tikekar wrote: >> >> Hi, >> I am looking for a variant of the boolean ITE(cond, x, y) function. I >> need only "cond" to be a bool while "x" and "y" are arbitrary symbols (they >> could be numbers, for example). Does sympy have a function like that? If >> not, any ideas on how I can go about writing one? Ideally, it should also >> be able to do simplifications. For example, ITE'(cond, a, b) + ITE'(cond, >> b, a) should be simplified to (a + b). >> >> Mehul >> > -- > 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/bb260428-4dca-45b2-ac40-dc5c01faab15%40googlegroups.com<https://groups.google.com/d/msgid/sympy/bb260428-4dca-45b2-ac40-dc5c01faab15%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKgW%3D6L8DXT0998s3tSVMNrJFuKn%2BoU7-S_2cAL3STxNZnaQEA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
