sympy/sympy — pull request #8602 by richardotis (2014-12-11 17:45:52+00:00)
Title: Add Theano printing support for And/Or logical operators.

This PR builds on #2366 and #2370 to add support for Theano translation of piecewise functions containing logical operators in their conditions. This is useful for specifying conditions that are the intersection of sets of numbers, e.g., c_1 <= x < c_2, or the union, e.g., x < c_1 or x > c_2.

Example (from included test):
```python
expr = sy.Piecewise((0, sy.And(x>0, x<2)), (x, sy.Or(x>2, x<0)))
result = theano_code(expr)
expected = tt.switch(tt.and_(xt>0, xt<2), 0, tt.switch(tt.or_(xt>2, xt<0), xt, np.nan))
assert theq(result, expected)
```