The Real Line and Open Intervals¶
The class OpenInterval
implement open intervals as 1-dimensional
differentiable manifolds over R. The derived class RealLine
is
devoted to R itself, as the open interval (−∞,+∞).
AUTHORS:
- Eric Gourgoulhon (2015): initial version
- Travis Scrimshaw (2016): review tweaks
REFERENCES:
-
class
sage.manifolds.differentiable.real_line.
OpenInterval
(lower, upper, ambient_interval=None, name=None, latex_name=None, coordinate=None, names=None, start_index=0)¶ Bases:
sage.manifolds.differentiable.manifold.DifferentiableManifold
Open interval as a 1-dimensional differentiable manifold over R.
INPUT:
lower
– lower bound of the interval (possibly-Infinity
)upper
– upper bound of the interval (possibly+Infinity
)ambient_interval
– (default:None
) another open interval, to which the constructed interval is a subset ofname
– (default:None
) string; name (symbol) given to the interval; ifNone
, the name is constructed fromlower
andupper
latex_name
– (default:None
) string; LaTeX symbol to denote the interval; ifNone
, the LaTeX symbol is constructed fromlower
andupper
ifname
isNone
, otherwise, it is set toname
coordinate
– (default:None
) string defining the symbol of the canonical coordinate set on the interval; if none is provided andnames
isNone
, the symbol ‘t’ is usednames
– (default:None
) used only whencoordinate
isNone
: it must be a single-element tuple containing the canonical coordinate symbol (this is guaranteed if the shortcut<names>
is used, see examples below)start_index
– (default: 0) unique value of the index for vectors and forms on the interval manifold
EXAMPLES:
The interval (0,π):
sage: I = OpenInterval(0, pi); I Real interval (0, pi) sage: latex(I) \left(0, \pi\right)
I
is a 1-dimensional smooth manifold over R:sage: I.category() Category of smooth manifolds over Real Field with 53 bits of precision sage: I.base_field() Real Field with 53 bits of precision sage: dim(I) 1
It is infinitely differentiable (smooth manifold):
sage: I.diff_degree() +Infinity
The instance is unique (as long as the constructor arguments are the same):
sage: I is OpenInterval(0, pi) True sage: I is OpenInterval(0, pi, name='I') False
The display of the interval can be customized:
sage: I # default display Real interval (0, pi) sage: latex(I) # default LaTeX display \left(0, \pi\right) sage: I1 = OpenInterval(0, pi, name='I'); I1 Real interval I sage: latex(I1) I sage: I2 = OpenInterval(0, pi, name='I', latex_name=r'\mathcal{I}'); I2 Real interval I sage: latex(I2) \mathcal{I}
I
is endowed with a canonical chart:sage: I.canonical_chart() Chart ((0, pi), (t,)) sage: I.canonical_chart() is I.default_chart() True sage: I.atlas() [Chart ((0, pi), (t,))]
The canonical coordinate is returned by the method
canonical_coordinate()
:sage: I.canonical_coordinate() t sage: t = I.canonical_coordinate() sage: type(t) <type 'sage.symbolic.expression.Expression'>
However, it can be obtained in the same step as the interval construction by means of the shortcut
I.<names>
:sage: I.<t> = OpenInterval(0, pi) sage: t t sage: type(t) <type 'sage.symbolic.expression.Expression'>
The trick is performed by the Sage preparser:
sage: preparse("I.<t> = OpenInterval(0, pi)") "I = OpenInterval(Integer(0), pi, names=('t',)); (t,) = I._first_ngens(1)"
In particular the shortcut can be used to set a canonical coordinate symbol different from
't'
:sage: J.<x> = OpenInterval(0, pi) sage: J.canonical_chart() Chart ((0, pi), (x,)) sage: J.canonical_coordinate() x
The LaTeX symbol of the canonical coordinate can be adjusted via the same syntax as a chart declaration (see
RealChart
):sage: J.<x> = OpenInterval(0, pi, coordinate=r'x:\xi') sage: latex(x) {\xi} sage: latex(J.canonical_chart()) \left(\left(0, \pi\right),({\xi})\right)
An element of the open interval
I
:sage: x = I.an_element(); x Point on the Real interval (0, pi) sage: x.coord() # coordinates in the default chart = canonical chart (1/2*pi,)
As for any manifold subset, a specific element of
I
can be created by providing a tuple containing its coordinate(s) in a given chart:sage: x = I((2,)) # (2,) = tuple of coordinates in the canonical chart sage: x Point on the Real interval (0, pi)
But for convenience, it can also be created directly from the coordinate:
sage: x = I(2); x Point on the Real interval (0, pi) sage: x.coord() (2,) sage: I(2) == I((2,)) True
By default, the coordinates passed for the element
x
are those relative to the canonical chart:sage: I(2) == I((2,), chart=I.canonical_chart()) True
The lower and upper bounds of the interval
I
:sage: I.lower_bound() 0 sage: I.upper_bound() pi
One of the endpoint can be infinite:
sage: J = OpenInterval(1, +oo); J Real interval (1, +Infinity) sage: J.an_element().coord() (2,)
The construction of a subinterval can be performed via the argument
ambient_interval
ofOpenInterval
:sage: J = OpenInterval(0, 1, ambient_interval=I); J Real interval (0, 1)
However, it is recommended to use the method
open_interval()
instead:sage: J = I.open_interval(0, 1); J Real interval (0, 1) sage: J.is_subset(I) True sage: J.manifold() is I True
A subinterval of a subinterval:
sage: K = J.open_interval(1/2, 1); K Real interval (1/2, 1) sage: K.is_subset(J) True sage: K.is_subset(I) True sage: K.manifold() is I True
We have:
sage: I.list_of_subsets() [Real interval (0, 1), Real interval (0, pi), Real interval (1/2, 1)] sage: J.list_of_subsets() [Real interval (0, 1), Real interval (1/2, 1)] sage: K.list_of_subsets() [Real interval (1/2, 1)]
As any open subset of a manifold, open subintervals are created in a category of subobjects of smooth manifolds:
sage: J.category() Join of Category of subobjects of sets and Category of smooth manifolds over Real Field with 53 bits of precision sage: K.category() Join of Category of subobjects of sets and Category of smooth manifolds over Real Field with 53 bits of precision
On the contrary,
I
, which has not been created as a subinterval, is in the category of smooth manifolds (seeManifolds
):sage: I.category() Category of smooth manifolds over Real Field with 53 bits of precision
and we have:
sage: J.category() is I.category().Subobjects() True
All intervals are parents:
sage: x = J(1/2); x Point on the Real interval (0, pi) sage: x.parent() is J True sage: y = K(3/4); y Point on the Real interval (0, pi) sage: y.parent() is K True
We have:
sage: x in I, x in J, x in K (True, True, False) sage: y in I, y in J, y in K (True, True, True)
The canonical chart of subintervals is inherited from the canonical chart of the parent interval:
sage: XI = I.canonical_chart(); XI Chart ((0, pi), (t,)) sage: XI.coord_range() t: (0, pi) sage: XJ = J.canonical_chart(); XJ Chart ((0, 1), (t,)) sage: XJ.coord_range() t: (0, 1) sage: XK = K.canonical_chart(); XK Chart ((1/2, 1), (t,)) sage: XK.coord_range() t: (1/2, 1)
-
canonical_chart
()¶ Return the canonical chart defined on
self
.OUTPUT:
EXAMPLES:
Canonical chart on the interval (0,π):
sage: I = OpenInterval(0, pi) sage: I.canonical_chart() Chart ((0, pi), (t,)) sage: I.canonical_chart().coord_range() t: (0, pi)
The symbol used for the coordinate of the canonical chart is that defined during the construction of the interval:
sage: I.<x> = OpenInterval(0, pi) sage: I.canonical_chart() Chart ((0, pi), (x,))
-
canonical_coordinate
()¶ Return the canonical coordinate defined on the interval.
OUTPUT:
- the symbolic variable representing the canonical coordinate
EXAMPLES:
Canonical coordinate on the interval (0,π):
sage: I = OpenInterval(0, pi) sage: I.canonical_coordinate() t sage: type(I.canonical_coordinate()) <type 'sage.symbolic.expression.Expression'> sage: I.canonical_coordinate().is_real() True
The canonical coordinate is the first (unique) coordinate of the canonical chart:
sage: I.canonical_coordinate() is I.canonical_chart()[0] True
Its default symbol is t; but it can be customized during the creation of the interval:
sage: I = OpenInterval(0, pi, coordinate='x') sage: I.canonical_coordinate() x sage: I.<x> = OpenInterval(0, pi) sage: I.canonical_coordinate() x
-
inf
()¶ Return the lower bound (infimum) of the interval.
EXAMPLES:
sage: I = OpenInterval(1/4, 3) sage: I.lower_bound() 1/4 sage: J = OpenInterval(-oo, 2) sage: J.lower_bound() -Infinity
An alias of
lower_bound()
isinf()
:sage: I.inf() 1/4 sage: J.inf() -Infinity
-
lower_bound
()¶ Return the lower bound (infimum) of the interval.
EXAMPLES:
sage: I = OpenInterval(1/4, 3) sage: I.lower_bound() 1/4 sage: J = OpenInterval(-oo, 2) sage: J.lower_bound() -Infinity
An alias of
lower_bound()
isinf()
:sage: I.inf() 1/4 sage: J.inf() -Infinity
-
open_interval
(lower, upper, name=None, latex_name=None)¶ Define an open subinterval of
self
.INPUT:
lower
– lower bound of the subinterval (possibly-Infinity
)upper
– upper bound of the subinterval (possibly+Infinity
)name
– (default:None
) string; name (symbol) given to the subinterval; ifNone
, the name is constructed fromlower
andupper
latex_name
– (default:None
) string; LaTeX symbol to denote the subinterval; ifNone
, the LaTeX symbol is constructed fromlower
andupper
ifname
isNone
, otherwise, it is set toname
OUTPUT:
OpenInterval
representing the open interval (lower
,upper
)
EXAMPLES:
The interval (0,π) as a subinterval of (−4,4):
sage: I = OpenInterval(-4, 4) sage: J = I.open_interval(0, pi); J Real interval (0, pi) sage: J.is_subset(I) True sage: I.list_of_subsets() [Real interval (-4, 4), Real interval (0, pi)]
J
is considered as an open submanifold ofI
:sage: J.manifold() is I True
The subinterval (−4,4) is
I
itself:sage: I.open_interval(-4, 4) is I True
-
sup
()¶ Return the upper bound (supremum) of the interval.
EXAMPLES:
sage: I = OpenInterval(1/4, 3) sage: I.upper_bound() 3 sage: J = OpenInterval(1, +oo) sage: J.upper_bound() +Infinity
An alias of
upper_bound()
issup()
:sage: I.sup() 3 sage: J.sup() +Infinity
-
upper_bound
()¶ Return the upper bound (supremum) of the interval.
EXAMPLES:
sage: I = OpenInterval(1/4, 3) sage: I.upper_bound() 3 sage: J = OpenInterval(1, +oo) sage: J.upper_bound() +Infinity
An alias of
upper_bound()
issup()
:sage: I.sup() 3 sage: J.sup() +Infinity
-
class
sage.manifolds.differentiable.real_line.
RealLine
(name='R', latex_name='\Bold{R}', coordinate=None, names=None, start_index=0)¶ Bases:
sage.manifolds.differentiable.real_line.OpenInterval
Field of real numbers, as a differentiable manifold of dimension 1 (real line) with a canonical coordinate chart.
INPUT:
name
– (default:'R'
) string; name (symbol) given to the real linelatex_name
– (default:r'\Bold{R}'
) string; LaTeX symbol to denote the real linecoordinate
– (default:None
) string defining the symbol of the canonical coordinate set on the real line; if none is provided andnames
isNone
, the symbol ‘t’ is usednames
– (default:None
) used only whencoordinate
isNone
: it must be a single-element tuple containing the canonical coordinate symbol (this is guaranteed if the shortcut<names>
is used, see examples below)start_index
– (default: 0) unique value of the index for vectors and forms on the real line manifold
EXAMPLES:
Constructing the real line without any argument:
sage: R = RealLine() ; R Real number line R sage: latex(R) \Bold{R}
R
is a 1-dimensional real smooth manifold:sage: R.category() Category of smooth manifolds over Real Field with 53 bits of precision sage: isinstance(R, sage.manifolds.differentiable.manifold.DifferentiableManifold) True sage: dim(R) 1
It is endowed with a canonical chart:
sage: R.canonical_chart() Chart (R, (t,)) sage: R.canonical_chart() is R.default_chart() True sage: R.atlas() [Chart (R, (t,))]
The instance is unique (as long as the constructor arguments are the same):
sage: R is RealLine() True sage: R is RealLine(latex_name='R') False
The canonical coordinate is returned by the method
canonical_coordinate()
:sage: R.canonical_coordinate() t sage: t = R.canonical_coordinate() sage: type(t) <type 'sage.symbolic.expression.Expression'>
However, it can be obtained in the same step as the real line construction by means of the shortcut
R.<names>
:sage: R.<t> = RealLine() sage: t t sage: type(t) <type 'sage.symbolic.expression.Expression'>
The trick is performed by Sage preparser:
sage: preparse("R.<t> = RealLine()") "R = RealLine(names=('t',)); (t,) = R._first_ngens(1)"
In particular the shortcut is to be used to set a canonical coordinate symbol different from ‘t’:
sage: R.<x> = RealLine() sage: R.canonical_chart() Chart (R, (x,)) sage: R.atlas() [Chart (R, (x,))] sage: R.canonical_coordinate() x
The LaTeX symbol of the canonical coordinate can be adjusted via the same syntax as a chart declaration (see
RealChart
):sage: R.<x> = RealLine(coordinate=r'x:\xi') sage: latex(x) {\xi} sage: latex(R.canonical_chart()) \left(\Bold{R},({\xi})\right)
The LaTeX symbol of the real line itself can also be customized:
sage: R.<x> = RealLine(latex_name=r'\mathbb{R}') sage: latex(R) \mathbb{R}
Elements of the real line can be constructed directly from a number:
sage: p = R(2) ; p Point on the Real number line R sage: p.coord() (2,) sage: p = R(1.742) ; p Point on the Real number line R sage: p.coord() (1.74200000000000,)
Symbolic variables can also be used:
sage: p = R(pi, name='pi') ; p Point pi on the Real number line R sage: p.coord() (pi,) sage: a = var('a') sage: p = R(a) ; p Point on the Real number line R sage: p.coord() (a,)
The real line is considered as the open interval (−∞,+∞):
sage: isinstance(R, sage.manifolds.differentiable.real_line.OpenInterval) True sage: R.lower_bound() -Infinity sage: R.upper_bound() +Infinity
A real interval can be created from
R
means of the methodopen_interval()
:sage: I = R.open_interval(0, 1); I Real interval (0, 1) sage: I.manifold() Real number line R sage: R.list_of_subsets() [Real interval (0, 1), Real number line R]