Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta-ticket: Piecewise functions, polyhedral complexes, piecewise functions of several variables, periodic piecewise functions #20877

Open
mkoeppe opened this issue Jun 24, 2016 · 41 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jun 24, 2016

This is a meta-ticket about piecewise functions.

Fractional part, modulo, ...:

Piecewise functions of 1 variable:

RealSets, underlying the current implementation of piecewise:

As a generalization, this meta-ticket will implement piecewise functions of several real variables.
The pieces are polyhedral complexes (not necessarily triangulations) or more generally polyhedral dissections (i.e., not necessarily face-to-face).
In my application, the functions will be piecewise linear, possibly discontinuous; but the implementation should be general enough for splines.

Discussion welcome, in particular in regard to how this code should interact with the existing classes for abstract complexes (CW complexes) and PointConfiguration.

General piecewise functions:

CC: @tscrim @rwst @vbraun @videlec @jhpalmieri @kcrisman @paulmasson @sagetrac-tmonteil @mo271 @jplab @yuan-zhou

Component: geometry

Keywords: piecewise

Issue created by migration from https://trac.sagemath.org/ticket/20877

@mkoeppe mkoeppe added this to the sage-7.3 milestone Jun 24, 2016
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Meta-ticket: Polyhedral complexes, piecewise functions of several variables Meta-ticket: Polyhedral complexes, piecewise functions of several variables, periodic piecewise functions Aug 10, 2016
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-7.3, sage-7.4 Aug 14, 2016
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Meta-ticket: Polyhedral complexes, piecewise functions of several variables, periodic piecewise functions Meta-ticket: Piecewise functions, polyhedral complexes, piecewise functions of several variables, periodic piecewise functions Oct 1, 2016
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe removed this from the sage-7.4 milestone Mar 10, 2018
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Mar 5, 2022
@xcaruso
Copy link
Contributor

xcaruso commented Mar 17, 2022

comment:38

I'm interested in implementing piecewise affine functions in one variable with specific methods that are easier to implement in this setting (e.g. compose, is_bijective, inverse, is_convex, convex_hull, laplace_transform, etc.) Mostly, I'm interested in the case where the coefficients of the affine parts are in QQ but I might also want to consider the case where they are in a fixed number field.

I'm wondering whether I should derive from the class sage.functions.piecewise.PiecewiseFunction (which is mostly concerned with symbolic expressions) or if it is okay if I rewrite my own class from scratch.

@mkoeppe
Copy link
Member Author

mkoeppe commented Mar 17, 2022

comment:39

I have code in https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/fast_piecewise.py, based on the old Sage implementation of piecewise, which may be a starting point. It is not tied to symbolics and uses the parent-element framework

@mkoeppe
Copy link
Member Author

mkoeppe commented Mar 17, 2022

@xcaruso
Copy link
Contributor

xcaruso commented Mar 23, 2022

comment:42

Replying to @mkoeppe:

I have code in https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/fast_piecewise.py, based on the old Sage implementation of piecewise, which may be a starting point. It is not tied to symbolics and uses the parent-element framework

That's great! Do you plan to propose this code for integration in sage at some point or not?

@yuan-zhou

This comment has been minimized.

@yuan-zhou
Copy link

comment:44

Replying to @xcaruso:

Replying to @mkoeppe:

I have code in https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/fast_piecewise.py, based on the old Sage implementation of piecewise, which may be a starting point. It is not tied to symbolics and uses the parent-element framework

That's great! Do you plan to propose this code for integration in sage at some point or not?

I'm familiar with the piecewise linear function code in the above github folder, and I'd love to have that integrated into sage. This has been on my wishlist for a few years, but the integration has never happened, partially because I don't have a clear view on where this new class should be derived from and what methods are useful to general users.

Besides the class hierarchy, I think that the main modification concerns changing the use of close or open or half-open intervals defined in https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/intervals.py to RealSet.

@mkoeppe
Copy link
Member Author

mkoeppe commented Mar 23, 2022

comment:45

Replying to @yuan-zhou:

Besides the class hierarchy, I think that the main modification concerns changing the use of close or open or half-open intervals defined in https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/intervals.py to RealSet.

Yes, that's an important task. Related: #32181

@yuan-zhou
Copy link

comment:46

Right, I notice that #32181 is related, and I added it into the description of this meta-ticket in comment:43.
Replying to @mkoeppe:

Replying to @yuan-zhou:

Besides the class hierarchy, I think that the main modification concerns changing the use of close or open or half-open intervals defined in https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/intervals.py to RealSet.

Yes, that's an important task. Related: #32181

@mkoeppe
Copy link
Member Author

mkoeppe commented Mar 23, 2022

comment:47

Regarding the class hierarchy, class PiecewiseLinearFunction_1d (ModuleElement) https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/fast_piecewise.py#L17 for the element is already good, I think. The corresponding parent is https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/cutgeneratingfunctionology/igp/fast_piecewise.py#L1221

There are many details so that it works correctly with all operations provided by the category.

If this is added to Sage, it would be best to put it somewhere that's not sage.functions because this package concerns symbolic functions.

If the scope remains piecewise linear functions (or even piecewise polynomial functions where the pieces are polyhedra such as box splines or simplex splines), then somewhere in sage.geometry would make sense because of its close ties to https://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedral_complex.html

Another connection: both indicator_function and convex_indicator_function (proposed to add in #32201) of polyhedra are, of course, piecewise linear functions.

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@NicoleYueqiLi

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants