I am referring to the ITE function defined in sympy here:
http://docs.sympy.org/dev/_modules/sympy/logic/boolalg.html#ITE. But it
requires all three arguments to be boolean. When I try:
cond, x, y = symbols('cond x y')
ITE(cond, x, y) + ITE(cond, y, x)
I get a TypeError: unsupported operand type(s) for +: 'Or' and 'Or'
On Friday, April 4, 2014 12:17:00 PM UTC-4, SAHIL SHEKHAWAT wrote:
>
> I don't understand what you mean by boolean ITE function can you please
> explain that?
> BUT I think ITE work well if "cond" is a bool when "x" and "y" are
> arbitary symbols. for example:
> IN [1]:* ITE**(True, x , y)*
> OUT [1]:* x*
>
> in the second part of your question if "cond" is a bool then yes ,*
> ITE'(cond, a, b) + ITE'(cond, b, a) *will return* (a+b)*
>
>
> On Fri, Apr 4, 2014 at 9:23 PM, Mehul Tikekar
> <[email protected]<javascript:>
> > 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] <javascript:>.
>> To post to this group, send email to [email protected] <javascript:>
>> .
>> 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/b5d8f3fc-d413-4ec2-ace0-76e21ac0bae7%40googlegroups.com<https://groups.google.com/d/msgid/sympy/b5d8f3fc-d413-4ec2-ace0-76e21ac0bae7%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/cf159478-1004-43a6-9dd1-932dee44acd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.