Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #31877
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 21, 2021
2 parents bc26d4f + 5b0f85d commit e768463
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 49 deletions.
9 changes: 5 additions & 4 deletions src/sage/functions/piecewise.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
r"""
Piecewise-defined Functions
Expand Down Expand Up @@ -527,7 +528,7 @@ def restriction(self, parameters, variable, restricted_domain):
sage: f = piecewise([((-oo, oo), x)]); f
piecewise(x|-->x on (-oo, +oo); x)
sage: f.restriction([[-1,1], [3,3]])
piecewise(x|-->x on [-1, 1] + {3}; x)
piecewise(x|-->x on [-1, 1] {3}; x)
"""
restricted_domain = RealSet(*restricted_domain)
new_param = []
Expand Down Expand Up @@ -559,7 +560,7 @@ def extension(self, parameters, variable, extension, extension_domain=None):
ValueError: point 3 is not in the domain
sage: g = f.extension(0); g
piecewise(x|-->x on (-1, 1), x|-->0 on (-oo, -1] + [1, +oo); x)
piecewise(x|-->x on (-1, 1), x|-->0 on (-oo, -1] [1, +oo); x)
sage: g(3)
0
Expand All @@ -583,7 +584,7 @@ def unextend_zero(self, parameters, variable):
sage: f = piecewise([((-1,1), x)]); f
piecewise(x|-->x on (-1, 1); x)
sage: g = f.extension(0); g
piecewise(x|-->x on (-1, 1), x|-->0 on (-oo, -1] + [1, +oo); x)
piecewise(x|-->x on (-1, 1), x|-->0 on (-oo, -1] [1, +oo); x)
sage: g(3)
0
sage: h = g.unextend_zero()
Expand Down Expand Up @@ -652,7 +653,7 @@ def piecewise_add(self, parameters, variable, other):
sage: f = piecewise([([0,1], 1), ((2,3), x)])
sage: g = piecewise([((1/2, 2), x)])
sage: f.piecewise_add(g).unextend_zero()
piecewise(x|-->1 on (0, 1/2], x|-->x + 1 on (1/2, 1], x|-->x on (1, 2) + (2, 3); x)
piecewise(x|-->1 on (0, 1/2], x|-->x + 1 on (1/2, 1], x|-->x on (1, 2) (2, 3); x)
"""
points = ([minus_infinity] +
sorted(set(self.end_points() + other.end_points())) +
Expand Down
Loading

0 comments on commit e768463

Please sign in to comment.