Issue 353: piecewise functions
http://code.google.com/p/sympy/issues/detail?id=353

Comment #25 by andy.terrel:
One problem I am having is that if a function isn't a piecewise function  
but contains a piecewise function, evaluating it on a interval can return  
an incorrect result or integration
won't call the piecewise integration routine.  I've gone back and forth on  
how to fix this.

One way to do fix this is to make any operation with a Piecewise function  
return a Piecewise function.  But this effectively mean rewriting the  
operators in basic.py to check any
forward binary operator has a piecewise function as an argument.  This  
method works well and only slowed down the benchmark by 1% on my machine  
but I think it is a bit ugly.

Another way that I didn't quite get to work.  For the interval evaluation  
just check to see if the args contains a Piecewise function and if so  
divide and conquer.  But the integration
is trickier because you can't just divide and conquer.  It seems that one  
needs to fold the expression in to the Piecewise object.  This would have a  
natural recursive structure but
will require to either have basic objects carry around a bool  
contains_Piecewise or require a check through the args for every time  
something could be different.

Any input would be helpful.



-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
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