Not sure if there should be a class Function from which you inherit. I would think PiecewiseFunctions should tie in with Sage's category framework. There's http://doc.sagemath.org/html/en/reference/categories/sage/categories/map.html#sage.categories.map.Map
On Thursday, November 8, 2018 at 2:36:40 AM UTC-8, Xavier Caruso wrote: > > Le lundi 5 novembre 2018, Vincent Delecroix a écrit : > > If you want to support composition of functions then you want to be > > able to take images of "nice sets" by "nice maps". In other words, > > you need a theory that supports quantifier elimination (see e.g. [1]). > > In the situation discussed by Matthias and Xavier, it is called > > Fourier-Motzkin elimination. > > I think that taking *inverse* images are enough (which is presumably > a little bit simpler and does not require quantifier elimination). > Indeed, if f and g are piecewise functions defined respectively by: > f(x) = f_i(x) if x in I_i (for i in some set) > g(x) = g_j(x) if x in J_j (for j in some other set) > we have: > f(g(x)) = f_i(g_j(x)) > when x is in the intersection of J_j and g_j^(-1)(I_i). > > By the way, I noticed that there is no particular support for real > valued functions in Sage (except if I missed something). At least > End(RR) returns the "Set of *Homomorphisms* from Real Field ... to > Real Field ...". Shouldn't we implement this? > More generally, shouldn't we implement a parent for the set of all > set-theoretical functions from A to B (where A and B are two given > parents)? > > So my concrete proposal would be to create a new class (say Function) > offering the methods inverse_image and composite (which could be not > implemented in all cases of course). > Then, we can build on this to implement PiecewiseFunctions. > > Any comments? > > --Xavier > > PS: Should we continue to discuss this on sage-devel or it is better > to move to trac (which ticket)? > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.