Comment #4 on issue 3025 by [email protected]: Piecewise evaluate=False does not work when conditions are boolean
http://code.google.com/p/sympy/issues/detail?id=3025

As Sean was explaining in the pull request, multiple True conditions makes sense if you want to be vague in the definition of the Piecewise, like Piecewise((2*x, x >=0), (-2*x, x <=0)). Notice that at 0, both conditions are True, but also both expressions are equal at that point. In general, we would have to do equivalence checking to see if this is the case, but I don't see any reason to do so. Just go with the first True condition.

One could also use this fact to be lazy about the definition of the conditions. For example, instead of writing Piecewise((x, x > 0), (y, And(x < 0, x > -1))), one could just write Piecewise((x, x > 0), (y, x > -1)). While I wouldn't necessarily recommend doing this, especially if you are going to use the printed output at all, it can be a convenience interactively, for example.

I can think of a couple of cases where evaluate=False might be useful, such as intermediate steps to some algorithm that wants things to always line up, or as a way to keep the information in the Piecewise around (delayed evaluation). And anyway, I don't see any harm in allowing it.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to