Opened 6 years ago
Last modified 5 months ago
#20877 new task
Meta-ticket: Piecewise functions, polyhedral complexes, piecewise functions of several variables, periodic piecewise functions
Reported by: | mkoeppe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.7 |
Component: | geometry | Keywords: | piecewise |
Cc: | tscrim, rws, vbraun, vdelecroix, jhpalmieri, kcrisman, paulmasson, tmonteil, moritz, jipilab, yzh | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
This is a meta-ticket about piecewise functions.
Fractional part, modulo, ...:
- #9935: Make a symbolic mod function
- #21232: Fractional part function {x}
- #21274: frac(x) immediate simplifications
- #21745: Standardize modulo operator % on real numbers (step 1)
- #21747: Standardize modulo operator % on real numbers (step 2)
- #21748: change the mod method of rationals
Piecewise functions of 1 variable:
- #1773: piecewise functions and integration / arithmetic do not play well together
- #8603: Partial sums are off for Fourier series of piecewise functions
- #11225: improve piecewise plotting
- #6895: Detect discontinuities when plotting the ceil function
- #10597: Riemann sums, added trapezoid option
- #21215: Periodic piecewise functions
- #21412: Convert piecewise functions to SymPy?
- #21618: plot in piecewise regression (?)
- #21709: Categories for piecewise functions
RealSet
s, underlying the current implementation of piecewise
:
- #16063: Unify the classes
RealSet
andUnionOfIntervals
- #21249:
RealSet
s fail theirTestSuite
:_test_category
,_test_pickling
- #21277:
sage_input
forRealSet
andpiecewise
- #21243:
RealSet
: add methodsclosure
,interior
,boundary
,is_open
,is_closed
- #31941: Make empty
RealSet
false - #31927:
RealSet
: Replaceis_included_in
byis_subset
/issubset
- #31930: Replace
UnionOfIntervals
byRealSet
- #31914:
RealSet.contains
: Handle symbolic argument - #31877: Refine category of
RealSet
- #32181:
RealSet
: Faster operations by scan-line (merging) techniques - #31740: Meta-ticket: Families, posets, complexes of manifold subsets
- #21242: Allow initializing
RealSet
fromRealInterval
orRBF
elements (dup: #17791)
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
.
- #20878:
PointConfiguration
: Addplot
method - #20879: Expose PPL's Not-Necessarily-Closed Polyhedra using Sage Polyhedra -- could play the same role as half-open intervals do in the context of the new piecewise functions.
- #22710: Meta-ticket: polymake
- #24943: Interface to polymake's polyhedral complexes
- #21151: Update TOPCOM to 0.17.7, disable outdated libsoplex support
- #26887: Implement
CombinatorialPolyhedron
- #27063: Transition of combinatorial computations of Polyhedron to Combinatorial Type
- #31842:
CombinatorialPolyhedralComplex
- #18197: Add CGAL package
General piecewise functions:
- #23923: Interface cases function with
SymPy
's piecewise - #20191: implement
SymPy
Piecewise
equivalent - #21412: Convert piecewise functions to
SymPy
Change History (47)
comment:1 Changed 6 years ago by
- Cc tscrim added
- Description modified (diff)
comment:2 Changed 6 years ago by
- Description modified (diff)
comment:3 Changed 6 years ago by
- Description modified (diff)
comment:4 Changed 6 years ago by
- Description modified (diff)
comment:5 Changed 6 years ago by
- Description modified (diff)
comment:6 Changed 6 years ago by
- Description modified (diff)
comment:7 Changed 6 years ago by
- Description modified (diff)
comment:8 Changed 6 years ago by
- Description modified (diff)
- Summary changed from Meta-ticket: Polyhedral complexes, piecewise functions of several variables to Meta-ticket: Polyhedral complexes, piecewise functions of several variables, periodic piecewise functions
comment:9 Changed 6 years ago by
- Description modified (diff)
comment:10 Changed 6 years ago by
- Description modified (diff)
comment:11 Changed 6 years ago by
- Cc rws vbraun vdelecroix added
- Description modified (diff)
- Milestone changed from sage-7.3 to sage-7.4
comment:12 Changed 6 years ago by
- Description modified (diff)
comment:13 Changed 6 years ago by
- Description modified (diff)
comment:14 Changed 6 years ago by
- Description modified (diff)
comment:15 Changed 6 years ago by
- Description modified (diff)
comment:16 Changed 6 years ago by
- Description modified (diff)
comment:17 Changed 6 years ago by
- Description modified (diff)
comment:18 Changed 6 years ago by
- Cc jhpalmieri added
comment:19 Changed 6 years ago by
- Cc kcrisman paulmasson added
comment:20 Changed 6 years ago by
- Description modified (diff)
- Summary changed from Meta-ticket: Polyhedral complexes, piecewise functions of several variables, periodic piecewise functions to Meta-ticket: Piecewise functions, polyhedral complexes, piecewise functions of several variables, periodic piecewise functions
comment:21 Changed 6 years ago by
- Description modified (diff)
comment:22 Changed 6 years ago by
- Cc tmonteil added
- Description modified (diff)
comment:23 Changed 6 years ago by
- Description modified (diff)
comment:24 Changed 5 years ago by
- Cc moritz added
comment:25 Changed 4 years ago by
- Cc jipilab added
- Description modified (diff)
- Milestone changed from sage-7.4 to sage-8.2
comment:26 Changed 4 years ago by
- Description modified (diff)
comment:27 Changed 4 years ago by
- Description modified (diff)
- Milestone changed from sage-8.2 to sage-8.5
comment:28 Changed 22 months ago by
- Description modified (diff)
- Milestone changed from sage-8.5 to sage-9.3
comment:29 Changed 18 months ago by
- Milestone changed from sage-9.3 to sage-9.4
comment:30 Changed 16 months ago by
- Description modified (diff)
comment:31 Changed 15 months ago by
- Description modified (diff)
comment:32 Changed 15 months ago by
- Description modified (diff)
comment:33 Changed 15 months ago by
- Description modified (diff)
comment:34 Changed 14 months ago by
- Description modified (diff)
comment:35 Changed 12 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:36 Changed 8 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:37 Changed 6 months ago by
- Milestone changed from sage-9.6 to sage-9.7
comment:38 Changed 5 months ago by
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.
comment:39 follow-up: ↓ 42 Changed 5 months ago by
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
comment:40 Changed 5 months ago by
comment:41 Changed 5 months ago by
- Cc yzh added
comment:42 in reply to: ↑ 39 ; follow-up: ↓ 44 Changed 5 months ago by
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?
comment:43 Changed 5 months ago by
- Description modified (diff)
comment:44 in reply to: ↑ 42 ; follow-up: ↓ 45 Changed 5 months ago by
Replying to caruso:
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 frameworkThat'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
.
comment:45 in reply to: ↑ 44 ; follow-up: ↓ 46 Changed 5 months ago by
Replying to yzh:
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
comment:46 in reply to: ↑ 45 Changed 5 months ago by
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 yzh:
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
comment:47 Changed 5 months ago by
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.
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.