```
In [1]: p = Piecewise( (0, x<0), (x, x<=1), (1, True)); p
Out[1]: 
/0  for x < 0 
|             
<x  for x <= 1
|             
\1  otherwise 

In [2]: integrate(p, (x, -5, 1))
Out[2]: 1/2

In [3]: integrate(p, (x, -5, z))
Out[3]: 
/   0     for z < 0 
|                   
|   2               
|  z                
<  --     for z <= 1
|  2                
|                   
|z - 1/2  otherwise 
\                   

In [4]: _.subs(z, 1)
Out[4]: 1/2
```

Solves issue http://code.google.com/p/sympy/issues/detail?id=2937

You can merge this Pull Request by running:

  git pull https://github.com/jrioux/sympy piecewise

Or you can view, comment on it, or merge it online at:

  https://github.com/sympy/sympy/pull/1376

-- Commit Summary --

* Piecewise._eval_interval(): Use an helper routine _sort_expr_cond().
* Handle And() in condition to Piecewise. Replaces the use of Interval().
* Handle interval evaluation with symbolic bounds in Piecewise.
* Add Piecewise tests.

-- File Changes --

M sympy/functions/elementary/piecewise.py (110)
M sympy/functions/elementary/tests/test_piecewise.py (10)

-- Patch Links --

  https://github.com/sympy/sympy/pull/1376.patch
  https://github.com/sympy/sympy/pull/1376.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/sympy/sympy/pull/1376

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

Reply via email to