On 11/05/2018 07:26 AM, Xavier Caruso wrote:
> Hello,
> ...
> 
> So IMHO, it makes sense (and it would be easier to review) to have two
> separated tickets, one for univariate functions and one for multivariate
> functions. Don't you agree?

I think the right design for piecewise functions is to work over any
domain that supports the right methods. The first thing your domain
needs is a "contains" method, i.e.

  f(x) = f_1(x) if domain_1.contains(x)
         f_2(x) if domain_2.contains(x)
         ...

We could also use a predicate instead of "contains", but I think
"contains" is a simple backwards-compatible default. Intervals and
convex polyhedral sets are just two examples that would work here; but
the same implementation should work for both. Checking whether or not
domain_1.contains(x) in 1d is conceptually the same thing as checking if
domain_1.contains( (x,y) ) in 2d.

While containment is the obvious thing, there are also some other
methods we'd need to implement the functions that we all want. For
example, to add two piecewise functions, you need to be able to
intersect their domain pieces. For example, if f has two pieces over
[0,1] and [1,2] and if g has one piece over [1/2, 3/2], then when you
add f+g, you want a new function with pieces over [1/2, 1] and [1, 3/2].
Again, intervals and convex polyhedral sets are just two examples where
this intersection is easy to compute.

Are there other methods we'd need on the pieces in order to implement
all of these functions? What sorts of domain objects support the things
we need? A little bit of thinking up front will save a lot of work down
the road.

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

Reply via email to