The Real Line and Open Intervals

The class OpenInterval implement open intervals as 1-dimensional differentiable manifolds over \(\RR\). The derived class RealLine is devoted to \(\RR\) itself, as the open interval \((-\infty, +\infty)\).

AUTHORS:

  • Eric Gourgoulhon (2015): initial version

  • Travis Scrimshaw (2016): review tweaks

REFERENCES:

class sage.manifolds.differentiable.examples.real_line.OpenInterval(lower, upper, ambient_interval=None, name=None, latex_name=None, coordinate=None, names=None, start_index=0)[source]

Bases: DifferentiableManifold

Open interval as a 1-dimensional differentiable manifold over \(\RR\).

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 of

  • name – (default: None) string; name (symbol) given to the interval; if None, the name is constructed from lower and upper

  • latex_name – (default: None) string; LaTeX symbol to denote the interval; if None, the LaTeX symbol is constructed from lower and upper if name is None, otherwise, it is set to name

  • coordinate – (default: None) string defining the symbol of the canonical coordinate set on the interval; if none is provided and names is None, the symbol ‘t’ is used

  • names – (default: None) used only when coordinate is None: 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,\pi)\):

sage: I = manifolds.OpenInterval(0, pi); I
Real interval (0, pi)
sage: latex(I)
\left(0, \pi\right)
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(0), pi); I
Real interval (0, pi)
>>> latex(I)
\left(0, \pi\right)
I = manifolds.OpenInterval(0, pi); I
latex(I)

I is a 1-dimensional smooth manifold over \(\RR\):

sage: I.category()
Category of smooth connected manifolds over Real Field with 53 bits of
 precision
sage: I.base_field()
Real Field with 53 bits of precision
sage: dim(I)
1
>>> from sage.all import *
>>> I.category()
Category of smooth connected manifolds over Real Field with 53 bits of
 precision
>>> I.base_field()
Real Field with 53 bits of precision
>>> dim(I)
1
I.category()
I.base_field()
dim(I)

It is infinitely differentiable (smooth manifold):

sage: I.diff_degree()
+Infinity
>>> from sage.all import *
>>> I.diff_degree()
+Infinity
I.diff_degree()

The instance is unique (as long as the constructor arguments are the same):

sage: I is manifolds.OpenInterval(0, pi)
True
sage: I is manifolds.OpenInterval(0, pi, name='I')
False
>>> from sage.all import *
>>> I is manifolds.OpenInterval(Integer(0), pi)
True
>>> I is manifolds.OpenInterval(Integer(0), pi, name='I')
False
I is manifolds.OpenInterval(0, pi)
I is manifolds.OpenInterval(0, pi, name='I')

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 = manifolds.OpenInterval(0, pi, name='I'); I1
Real interval I
sage: latex(I1)
I
sage: I2 = manifolds.OpenInterval(0, pi, name='I', latex_name=r'\mathcal{I}'); I2
Real interval I
sage: latex(I2)
\mathcal{I}
>>> from sage.all import *
>>> I  # default display
Real interval (0, pi)
>>> latex(I)  # default LaTeX display
\left(0, \pi\right)
>>> I1 = manifolds.OpenInterval(Integer(0), pi, name='I'); I1
Real interval I
>>> latex(I1)
I
>>> I2 = manifolds.OpenInterval(Integer(0), pi, name='I', latex_name=r'\mathcal{I}'); I2
Real interval I
>>> latex(I2)
\mathcal{I}
I  # default display
latex(I)  # default LaTeX display
I1 = manifolds.OpenInterval(0, pi, name='I'); I1
latex(I1)
I2 = manifolds.OpenInterval(0, pi, name='I', latex_name=r'\mathcal{I}'); I2
latex(I2)

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,))]
>>> from sage.all import *
>>> I.canonical_chart()
Chart ((0, pi), (t,))
>>> I.canonical_chart() is I.default_chart()
True
>>> I.atlas()
[Chart ((0, pi), (t,))]
I.canonical_chart()
I.canonical_chart() is I.default_chart()
I.atlas()

The canonical coordinate is returned by the method canonical_coordinate():

sage: I.canonical_coordinate()
t
sage: t = I.canonical_coordinate()
sage: type(t)
<class 'sage.symbolic.expression.Expression'>
>>> from sage.all import *
>>> I.canonical_coordinate()
t
>>> t = I.canonical_coordinate()
>>> type(t)
<class 'sage.symbolic.expression.Expression'>
I.canonical_coordinate()
t = I.canonical_coordinate()
type(t)

However, it can be obtained in the same step as the interval construction by means of the shortcut I.<names>:

sage: I.<t> = manifolds.OpenInterval(0, pi)
sage: t
t
sage: type(t)
<class 'sage.symbolic.expression.Expression'>
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(0), pi, names=('t',)); (t,) = I._first_ngens(1)
>>> t
t
>>> type(t)
<class 'sage.symbolic.expression.Expression'>
I.<t> = manifolds.OpenInterval(0, pi)
t
type(t)

The trick is performed by the Sage preparser:

sage: preparse("I.<t> = manifolds.OpenInterval(0, pi)")
"I = manifolds.OpenInterval(Integer(0), pi, names=('t',)); (t,) = I._first_ngens(1)"
>>> from sage.all import *
>>> preparse("I.<t> = manifolds.OpenInterval(0, pi)")
"I = manifolds.OpenInterval(Integer(0), pi, names=('t',)); (t,) = I._first_ngens(1)"
preparse("I.<t> = manifolds.OpenInterval(0, pi)")

In particular the shortcut can be used to set a canonical coordinate symbol different from 't':

sage: J.<x> = manifolds.OpenInterval(0, pi)
sage: J.canonical_chart()
Chart ((0, pi), (x,))
sage: J.canonical_coordinate()
x
>>> from sage.all import *
>>> J = manifolds.OpenInterval(Integer(0), pi, names=('x',)); (x,) = J._first_ngens(1)
>>> J.canonical_chart()
Chart ((0, pi), (x,))
>>> J.canonical_coordinate()
x
J.<x> = manifolds.OpenInterval(0, pi)
J.canonical_chart()
J.canonical_coordinate()

The LaTeX symbol of the canonical coordinate can be adjusted via the same syntax as a chart declaration (see RealChart):

sage: J.<x> = manifolds.OpenInterval(0, pi, coordinate=r'x:\xi')
sage: latex(x)
{\xi}
sage: latex(J.canonical_chart())
\left(\left(0, \pi\right),({\xi})\right)
>>> from sage.all import *
>>> J = manifolds.OpenInterval(Integer(0), pi, coordinate=r'x:\xi', names=('x',)); (x,) = J._first_ngens(1)
>>> latex(x)
{\xi}
>>> latex(J.canonical_chart())
\left(\left(0, \pi\right),({\xi})\right)
J.<x> = manifolds.OpenInterval(0, pi, coordinate=r'x:\xi')
latex(x)
latex(J.canonical_chart())

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,)
>>> from sage.all import *
>>> x = I.an_element(); x
Point on the Real interval (0, pi)
>>> x.coord() # coordinates in the default chart = canonical chart
(1/2*pi,)
x = I.an_element(); x
x.coord() # coordinates in the default chart = canonical chart

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)
>>> from sage.all import *
>>> x = I((Integer(2),)) # (2,) = tuple of coordinates in the canonical chart
>>> x
Point on the Real interval (0, pi)
x = I((2,)) # (2,) = tuple of coordinates in the canonical chart
x

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
>>> from sage.all import *
>>> x = I(Integer(2)); x
Point on the Real interval (0, pi)
>>> x.coord()
(2,)
>>> I(Integer(2)) == I((Integer(2),))
True
x = I(2); x
x.coord()
I(2) == I((2,))

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
>>> from sage.all import *
>>> I(Integer(2)) ==  I((Integer(2),), chart=I.canonical_chart())
True
I(2) ==  I((2,), chart=I.canonical_chart())

The lower and upper bounds of the interval I:

sage: I.lower_bound()
0
sage: I.upper_bound()
pi
>>> from sage.all import *
>>> I.lower_bound()
0
>>> I.upper_bound()
pi
I.lower_bound()
I.upper_bound()

One of the endpoint can be infinite:

sage: J = manifolds.OpenInterval(1, +oo); J
Real interval (1, +Infinity)
sage: J.an_element().coord()
(2,)
>>> from sage.all import *
>>> J = manifolds.OpenInterval(Integer(1), +oo); J
Real interval (1, +Infinity)
>>> J.an_element().coord()
(2,)
J = manifolds.OpenInterval(1, +oo); J
J.an_element().coord()

The construction of a subinterval can be performed via the argument ambient_interval of OpenInterval:

sage: J = manifolds.OpenInterval(0, 1, ambient_interval=I); J
Real interval (0, 1)
>>> from sage.all import *
>>> J = manifolds.OpenInterval(Integer(0), Integer(1), ambient_interval=I); J
Real interval (0, 1)
J = manifolds.OpenInterval(0, 1, ambient_interval=I); J

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
>>> from sage.all import *
>>> J = I.open_interval(Integer(0), Integer(1)); J
Real interval (0, 1)
>>> J.is_subset(I)
True
>>> J.manifold() is I
True
J = I.open_interval(0, 1); J
J.is_subset(I)
J.manifold() is I

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
>>> from sage.all import *
>>> K = J.open_interval(Integer(1)/Integer(2), Integer(1)); K
Real interval (1/2, 1)
>>> K.is_subset(J)
True
>>> K.is_subset(I)
True
>>> K.manifold() is I
True
K = J.open_interval(1/2, 1); K
K.is_subset(J)
K.is_subset(I)
K.manifold() is I

We have:

sage: list(I.subset_family())
[Real interval (0, 1), Real interval (0, pi), Real interval (1/2, 1)]
sage: list(J.subset_family())
[Real interval (0, 1), Real interval (1/2, 1)]
sage: list(K.subset_family())
[Real interval (1/2, 1)]
>>> from sage.all import *
>>> list(I.subset_family())
[Real interval (0, 1), Real interval (0, pi), Real interval (1/2, 1)]
>>> list(J.subset_family())
[Real interval (0, 1), Real interval (1/2, 1)]
>>> list(K.subset_family())
[Real interval (1/2, 1)]
list(I.subset_family())
list(J.subset_family())
list(K.subset_family())

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 and Category of connected
 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 and Category of connected
 manifolds over Real Field with 53 bits of precision
>>> from sage.all import *
>>> J.category()
Join of Category of subobjects of sets and Category of smooth manifolds
 over Real Field with 53 bits of precision and Category of connected
 manifolds over Real Field with 53 bits of precision
>>> K.category()
Join of Category of subobjects of sets and Category of smooth manifolds
 over Real Field with 53 bits of precision and Category of connected
 manifolds over Real Field with 53 bits of precision
J.category()
K.category()

On the contrary, I, which has not been created as a subinterval, is in the category of smooth manifolds (see Manifolds):

sage: I.category()
Category of smooth connected manifolds over Real Field with 53 bits of
 precision
>>> from sage.all import *
>>> I.category()
Category of smooth connected manifolds over Real Field with 53 bits of
 precision
I.category()

and we have:

sage: J.category() is I.category().Subobjects()
True
>>> from sage.all import *
>>> J.category() is I.category().Subobjects()
True
J.category() is I.category().Subobjects()

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
>>> from sage.all import *
>>> x = J(Integer(1)/Integer(2)); x
Point on the Real interval (0, pi)
>>> x.parent() is J
True
>>> y = K(Integer(3)/Integer(4)); y
Point on the Real interval (0, pi)
>>> y.parent() is K
True
x = J(1/2); x
x.parent() is J
y = K(3/4); y
y.parent() is K

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)
>>> from sage.all import *
>>> x in I, x in J, x in K
(True, True, False)
>>> y in I, y in J, y in K
(True, True, True)
x in I, x in J, x in K
y in I, y in J, y in K

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)
>>> from sage.all import *
>>> XI = I.canonical_chart(); XI
Chart ((0, pi), (t,))
>>> XI.coord_range()
t: (0, pi)
>>> XJ = J.canonical_chart(); XJ
Chart ((0, 1), (t,))
>>> XJ.coord_range()
t: (0, 1)
>>> XK = K.canonical_chart(); XK
Chart ((1/2, 1), (t,))
>>> XK.coord_range()
t: (1/2, 1)
XI = I.canonical_chart(); XI
XI.coord_range()
XJ = J.canonical_chart(); XJ
XJ.coord_range()
XK = K.canonical_chart(); XK
XK.coord_range()
canonical_chart()[source]

Return the canonical chart defined on self.

OUTPUT: RealDiffChart

EXAMPLES:

Canonical chart on the interval \((0, \pi)\):

sage: I = manifolds.OpenInterval(0, pi)
sage: I.canonical_chart()
Chart ((0, pi), (t,))
sage: I.canonical_chart().coord_range()
t: (0, pi)
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(0), pi)
>>> I.canonical_chart()
Chart ((0, pi), (t,))
>>> I.canonical_chart().coord_range()
t: (0, pi)
I = manifolds.OpenInterval(0, pi)
I.canonical_chart()
I.canonical_chart().coord_range()

The symbol used for the coordinate of the canonical chart is that defined during the construction of the interval:

sage: I.<x> = manifolds.OpenInterval(0, pi)
sage: I.canonical_chart()
Chart ((0, pi), (x,))
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(0), pi, names=('x',)); (x,) = I._first_ngens(1)
>>> I.canonical_chart()
Chart ((0, pi), (x,))
I.<x> = manifolds.OpenInterval(0, pi)
I.canonical_chart()
canonical_coordinate()[source]

Return the canonical coordinate defined on the interval.

OUTPUT: the symbolic variable representing the canonical coordinate

EXAMPLES:

Canonical coordinate on the interval \((0, \pi)\):

sage: I = manifolds.OpenInterval(0, pi)
sage: I.canonical_coordinate()
t
sage: type(I.canonical_coordinate())
<class 'sage.symbolic.expression.Expression'>
sage: I.canonical_coordinate().is_real()
True
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(0), pi)
>>> I.canonical_coordinate()
t
>>> type(I.canonical_coordinate())
<class 'sage.symbolic.expression.Expression'>
>>> I.canonical_coordinate().is_real()
True
I = manifolds.OpenInterval(0, pi)
I.canonical_coordinate()
type(I.canonical_coordinate())
I.canonical_coordinate().is_real()

The canonical coordinate is the first (unique) coordinate of the canonical chart:

sage: I.canonical_coordinate() is I.canonical_chart()[0]
True
>>> from sage.all import *
>>> I.canonical_coordinate() is I.canonical_chart()[Integer(0)]
True
I.canonical_coordinate() is I.canonical_chart()[0]

Its default symbol is \(t\); but it can be customized during the creation of the interval:

sage: I = manifolds.OpenInterval(0, pi, coordinate='x')
sage: I.canonical_coordinate()
x
sage: I.<x> = manifolds.OpenInterval(0, pi)
sage: I.canonical_coordinate()
x
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(0), pi, coordinate='x')
>>> I.canonical_coordinate()
x
>>> I = manifolds.OpenInterval(Integer(0), pi, names=('x',)); (x,) = I._first_ngens(1)
>>> I.canonical_coordinate()
x
I = manifolds.OpenInterval(0, pi, coordinate='x')
I.canonical_coordinate()
I.<x> = manifolds.OpenInterval(0, pi)
I.canonical_coordinate()
inf()[source]

alias of lower_bound().

lower_bound()[source]

Return the lower bound (infimum) of the interval.

EXAMPLES:

sage: I = manifolds.OpenInterval(1/4, 3)
sage: I.lower_bound()
1/4
sage: J = manifolds.OpenInterval(-oo, 2)
sage: J.lower_bound()
-Infinity
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(1)/Integer(4), Integer(3))
>>> I.lower_bound()
1/4
>>> J = manifolds.OpenInterval(-oo, Integer(2))
>>> J.lower_bound()
-Infinity
I = manifolds.OpenInterval(1/4, 3)
I.lower_bound()
J = manifolds.OpenInterval(-oo, 2)
J.lower_bound()

An alias of lower_bound() is inf():

sage: I.inf()
1/4
sage: J.inf()
-Infinity
>>> from sage.all import *
>>> I.inf()
1/4
>>> J.inf()
-Infinity
I.inf()
J.inf()
open_interval(lower, upper, name=None, latex_name=None)[source]

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; if None, the name is constructed from lower and upper

  • latex_name – (default: None) string; LaTeX symbol to denote the subinterval; if None, the LaTeX symbol is constructed from lower and upper if name is None, otherwise, it is set to name

OUTPUT:

  • OpenInterval representing the open interval (lower, upper)

EXAMPLES:

The interval \((0, \pi)\) as a subinterval of \((-4, 4)\):

sage: I = manifolds.OpenInterval(-4, 4)
sage: J = I.open_interval(0, pi); J
Real interval (0, pi)
sage: J.is_subset(I)
True
sage: list(I.subset_family())
[Real interval (-4, 4), Real interval (0, pi)]
>>> from sage.all import *
>>> I = manifolds.OpenInterval(-Integer(4), Integer(4))
>>> J = I.open_interval(Integer(0), pi); J
Real interval (0, pi)
>>> J.is_subset(I)
True
>>> list(I.subset_family())
[Real interval (-4, 4), Real interval (0, pi)]
I = manifolds.OpenInterval(-4, 4)
J = I.open_interval(0, pi); J
J.is_subset(I)
list(I.subset_family())

J is considered as an open submanifold of I:

sage: J.manifold() is I
True
>>> from sage.all import *
>>> J.manifold() is I
True
J.manifold() is I

The subinterval \((-4, 4)\) is I itself:

sage: I.open_interval(-4, 4) is I
True
>>> from sage.all import *
>>> I.open_interval(-Integer(4), Integer(4)) is I
True
I.open_interval(-4, 4) is I
sup()[source]

alias of upper_bound().

upper_bound()[source]

Return the upper bound (supremum) of the interval.

EXAMPLES:

sage: I = manifolds.OpenInterval(1/4, 3)
sage: I.upper_bound()
3
sage: J = manifolds.OpenInterval(1, +oo)
sage: J.upper_bound()
+Infinity
>>> from sage.all import *
>>> I = manifolds.OpenInterval(Integer(1)/Integer(4), Integer(3))
>>> I.upper_bound()
3
>>> J = manifolds.OpenInterval(Integer(1), +oo)
>>> J.upper_bound()
+Infinity
I = manifolds.OpenInterval(1/4, 3)
I.upper_bound()
J = manifolds.OpenInterval(1, +oo)
J.upper_bound()

An alias of upper_bound() is sup():

sage: I.sup()
3
sage: J.sup()
+Infinity
>>> from sage.all import *
>>> I.sup()
3
>>> J.sup()
+Infinity
I.sup()
J.sup()
class sage.manifolds.differentiable.examples.real_line.RealLine(name='ℝ', latex_name='\\Bold{R}', coordinate=None, names=None, start_index=0)[source]

Bases: 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 line

  • latex_name – (default: r'\Bold{R}') string; LaTeX symbol to denote the real line

  • coordinate – (default: None) string defining the symbol of the canonical coordinate set on the real line; if none is provided and names is None, the symbol ‘t’ is used

  • names – (default: None) used only when coordinate is None: 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 = manifolds.RealLine() ; R
Real number line ℝ
sage: latex(R)
\Bold{R}
>>> from sage.all import *
>>> R = manifolds.RealLine() ; R
Real number line ℝ
>>> latex(R)
\Bold{R}
R = manifolds.RealLine() ; R
latex(R)

R is a 1-dimensional real smooth manifold:

sage: R.category()
Category of smooth connected manifolds over Real Field with 53 bits of
 precision
sage: isinstance(R, sage.manifolds.differentiable.manifold.DifferentiableManifold)
True
sage: dim(R)
1
>>> from sage.all import *
>>> R.category()
Category of smooth connected manifolds over Real Field with 53 bits of
 precision
>>> isinstance(R, sage.manifolds.differentiable.manifold.DifferentiableManifold)
True
>>> dim(R)
1
R.category()
isinstance(R, sage.manifolds.differentiable.manifold.DifferentiableManifold)
dim(R)

It is endowed with a canonical chart:

sage: R.canonical_chart()
Chart (ℝ, (t,))
sage: R.canonical_chart() is R.default_chart()
True
sage: R.atlas()
[Chart (ℝ, (t,))]
>>> from sage.all import *
>>> R.canonical_chart()
Chart (ℝ, (t,))
>>> R.canonical_chart() is R.default_chart()
True
>>> R.atlas()
[Chart (ℝ, (t,))]
R.canonical_chart()
R.canonical_chart() is R.default_chart()
R.atlas()

The instance is unique (as long as the constructor arguments are the same):

sage: R is manifolds.RealLine()
True
sage: R is manifolds.RealLine(latex_name='R')
False
>>> from sage.all import *
>>> R is manifolds.RealLine()
True
>>> R is manifolds.RealLine(latex_name='R')
False
R is manifolds.RealLine()
R is manifolds.RealLine(latex_name='R')

The canonical coordinate is returned by the method canonical_coordinate():

sage: R.canonical_coordinate()
t
sage: t = R.canonical_coordinate()
sage: type(t)
<class 'sage.symbolic.expression.Expression'>
>>> from sage.all import *
>>> R.canonical_coordinate()
t
>>> t = R.canonical_coordinate()
>>> type(t)
<class 'sage.symbolic.expression.Expression'>
R.canonical_coordinate()
t = R.canonical_coordinate()
type(t)

However, it can be obtained in the same step as the real line construction by means of the shortcut R.<names>:

sage: R.<t> = manifolds.RealLine()
sage: t
t
sage: type(t)
<class 'sage.symbolic.expression.Expression'>
>>> from sage.all import *
>>> R = manifolds.RealLine(names=('t',)); (t,) = R._first_ngens(1)
>>> t
t
>>> type(t)
<class 'sage.symbolic.expression.Expression'>
R.<t> = manifolds.RealLine()
t
type(t)

The trick is performed by Sage preparser:

sage: preparse("R.<t> = manifolds.RealLine()")
"R = manifolds.RealLine(names=('t',)); (t,) = R._first_ngens(1)"
>>> from sage.all import *
>>> preparse("R.<t> = manifolds.RealLine()")
"R = manifolds.RealLine(names=('t',)); (t,) = R._first_ngens(1)"
preparse("R.<t> = manifolds.RealLine()")

In particular the shortcut is to be used to set a canonical coordinate symbol different from ‘t’:

sage: R.<x> = manifolds.RealLine()
sage: R.canonical_chart()
Chart (ℝ, (x,))
sage: R.atlas()
[Chart (ℝ, (x,))]
sage: R.canonical_coordinate()
x
>>> from sage.all import *
>>> R = manifolds.RealLine(names=('x',)); (x,) = R._first_ngens(1)
>>> R.canonical_chart()
Chart (ℝ, (x,))
>>> R.atlas()
[Chart (ℝ, (x,))]
>>> R.canonical_coordinate()
x
R.<x> = manifolds.RealLine()
R.canonical_chart()
R.atlas()
R.canonical_coordinate()

The LaTeX symbol of the canonical coordinate can be adjusted via the same syntax as a chart declaration (see RealChart):

sage: R.<x> = manifolds.RealLine(coordinate=r'x:\xi')
sage: latex(x)
{\xi}
sage: latex(R.canonical_chart())
\left(\Bold{R},({\xi})\right)
>>> from sage.all import *
>>> R = manifolds.RealLine(coordinate=r'x:\xi', names=('x',)); (x,) = R._first_ngens(1)
>>> latex(x)
{\xi}
>>> latex(R.canonical_chart())
\left(\Bold{R},({\xi})\right)
R.<x> = manifolds.RealLine(coordinate=r'x:\xi')
latex(x)
latex(R.canonical_chart())

The LaTeX symbol of the real line itself can also be customized:

sage: R.<x> = manifolds.RealLine(latex_name=r'\mathbb{R}')
sage: latex(R)
\mathbb{R}
>>> from sage.all import *
>>> R = manifolds.RealLine(latex_name=r'\mathbb{R}', names=('x',)); (x,) = R._first_ngens(1)
>>> latex(R)
\mathbb{R}
R.<x> = manifolds.RealLine(latex_name=r'\mathbb{R}')
latex(R)

Elements of the real line can be constructed directly from a number:

sage: p = R(2) ; p
Point on the Real number line ℝ
sage: p.coord()
(2,)
sage: p = R(1.742) ; p
Point on the Real number line ℝ
sage: p.coord()
(1.74200000000000,)
>>> from sage.all import *
>>> p = R(Integer(2)) ; p
Point on the Real number line ℝ
>>> p.coord()
(2,)
>>> p = R(RealNumber('1.742')) ; p
Point on the Real number line ℝ
>>> p.coord()
(1.74200000000000,)
p = R(2) ; p
p.coord()
p = R(1.742) ; p
p.coord()

Symbolic variables can also be used:

sage: p = R(pi, name='pi') ; p
Point pi on the Real number line ℝ
sage: p.coord()
(pi,)
sage: a = var('a')
sage: p = R(a) ; p
Point on the Real number line ℝ
sage: p.coord()
(a,)
>>> from sage.all import *
>>> p = R(pi, name='pi') ; p
Point pi on the Real number line ℝ
>>> p.coord()
(pi,)
>>> a = var('a')
>>> p = R(a) ; p
Point on the Real number line ℝ
>>> p.coord()
(a,)
p = R(pi, name='pi') ; p
p.coord()
a = var('a')
p = R(a) ; p
p.coord()

The real line is considered as the open interval \((-\infty, +\infty)\):

sage: isinstance(R, sage.manifolds.differentiable.examples.real_line.OpenInterval)
True
sage: R.lower_bound()
-Infinity
sage: R.upper_bound()
+Infinity
>>> from sage.all import *
>>> isinstance(R, sage.manifolds.differentiable.examples.real_line.OpenInterval)
True
>>> R.lower_bound()
-Infinity
>>> R.upper_bound()
+Infinity
isinstance(R, sage.manifolds.differentiable.examples.real_line.OpenInterval)
R.lower_bound()
R.upper_bound()

A real interval can be created from R means of the method open_interval():

sage: I = R.open_interval(0, 1); I
Real interval (0, 1)
sage: I.manifold()
Real number line ℝ
sage: list(R.subset_family())
[Real interval (0, 1), Real number line ℝ]
>>> from sage.all import *
>>> I = R.open_interval(Integer(0), Integer(1)); I
Real interval (0, 1)
>>> I.manifold()
Real number line ℝ
>>> list(R.subset_family())
[Real interval (0, 1), Real number line ℝ]
I = R.open_interval(0, 1); I
I.manifold()
list(R.subset_family())