sympy/sympy — pull request #1421 by jrioux (2012-07-15 13:06:59+00:00)
Title: Piecewise improvements

This brings a few improvements to Piecewise:

Implement methods such as _eval_conjugate, _eval_power, etc. to allow for simplifications. Implement the is_real, etc. assumption methods. Fix the canonalization of Piecewise with multiple otherwise conditions. Don't allow a Set() inside a condition, instead use Set().contains(x). In general, clean up the code and bring the test coverage to 100%.

Fixes:
as_real_imag for Piecewise does not give correct answer
http://code.google.com/p/sympy/issues/detail?id=1964

Piecewise((1,Interval(0,1,False,True)),(0,True)) syntax should not be allowed
http://code.google.com/p/sympy/issues/detail?id=2726

Piecewise evaluate=False does not work when conditions are boolean
http://code.google.com/p/sympy/issues/detail?id=3025

Piecewise.as_leading_term is broken
http://code.google.com/p/sympy/issues/detail?id=3110