A piecewise could be thought of as a list of (Expr, Boolean) pairs.  We can
translate this into a set of (Expr, Set) pairs, intersect each set with the
set that is input to imageset, apply that particular expr, and then Union
all of the imagesets together.  That may have been a little unclear.  To
make it more explicit consider the following transformation:

imageset(x, Piecewise((expr1, set1), (expr2, set2), (expr3, set3)),
input_set)

->

Union(imageset(x, expr1, Intersection(set1, input_set)),
      imageset(x, expr2, Intersection(set2, input_set)),
      imageset(x, expr3, Intersection(set3, input_set)))

In translating the booleans to sets there are good tools in SymPy to help
with this for any particular bool->set transformation.  If you're
interested in this I can poke around a bit to find them.  We'll also have
to be careful about this transformation because Piecewise booleans are
ordered so that the first ones take precedence.  We'll have to use either
set subtraction or boolean arithmetic here to remove parts.

Again, I'm not sure how clear this was.  Please ask for clarification where
needed.



On Sun, Jan 5, 2014 at 11:49 PM, Harsh Gupta <gupta.hars...@gmail.com>wrote:

> I'm working on improving the imageset evaluation for Intervals on
> https://github.com/sympy/sympy/pull/2723
>  imagset basically returns the set of possible outputs of a functions
> given an input set. I want to extend this functionality to piecewise
> functions.
> So I want to know if there is a general method to find the critical points
> of piecewise functions.
>
> --
> Harsh Gupta
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to