Status: Accepted
Owner: asmeurer
CC: andy.terrel
Labels: Type-Defect Priority-Medium WrongResult Integration

New issue 1950 by asmeurer: Piecewise((x, 0 < x), (0, Eq(x, 0)), (-x, x < 0))._eval_interval(x, -1, 1) is wrong
http://code.google.com/p/sympy/issues/detail?id=1950

In [30]: Piecewise((x, 0 < x), (0, Eq(x, 0)), (-x, x < 0))._eval_interval(x, -1, 1)
Out[30]: 1

In [31]: Piecewise((x, 0 < x), (0, Eq(x, 0)), (-x, x < 0)).subs(x, 1)
Out[31]: 1

In [32]: Piecewise((x, 0 < x), (0, Eq(x, 0)), (-x, x < 0)).subs(x, -1)
Out[32]: 1

So it is obviously wrong. This leads to the incorrect result mentioned in issue 1113, comment 6.
You may notice that the above Piecewise is the same as abs(x):

In [33]: abs(x)._eval_interval(x, -1, 1)
Out[33]: 0

Also, why is there the complicated code for _eval_interval for Piecewise instead of the standard
Piecewise.subs(x, 1) - Piecewise.subs(x, -1) behavior?

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

Reply via email to