Coordinate Functions¶
In the context of a topological manifold
over a topological field
,
a coordinate function is a function from a chart codomain
to
. In other words, a coordinate function is a
-valued function of
the coordinates associated to some chart.
More precisely, let
be a chart on
, i.e.
is an open
subset of
and
is a homeomorphism
from
to an open subset
of
. A coordinate function associated
to the chart
is a function

Coordinate functions are implemented by derived classes of the abstract base
class CoordFunction.
The class MultiCoordFunction implements
-valued functions of
the coordinates of a chart, with
a positive integer.
AUTHORS:
- Eric Gourgoulhon, Michal Bejger (2013-2015) : initial version
- Travis Scrimshaw (2016) : make
CoordFunctioninheritate fromAlgebraElement
-
class
sage.manifolds.coord_func.CoordFunction(parent)¶ Bases:
sage.structure.element.AlgebraElementAbstract base class for coordinate functions.
If
is a chart on a topological manifold
of
dimension
over a topological field
, a coordinate function
associated to
is a map
, where
is the codomain of
. In other words,
is a
-valued
function of the coordinates associated to the chart
.The class
CoordFunctionis an abstract one. Specific coordinate functions must be implemented by derived classes, likeCoordFunctionSymbfor symbolic coordinate functions.INPUT:
parent– the algebra of coordinate functions on a given chart
-
arccos()¶ Arc cosine of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.arccos() Traceback (most recent call last): ... NotImplementedError: <abstract method arccos at 0x...>
- coordinate function
-
arccosh()¶ Inverse hyperbolic cosine of
self.OUTPUT:
- coordinate function
, where
is the current
coordinate function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.arccosh() Traceback (most recent call last): ... NotImplementedError: <abstract method arccosh at 0x...>
- coordinate function
-
arcsin()¶ Arc sine of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.arcsin() Traceback (most recent call last): ... NotImplementedError: <abstract method arcsin at 0x...>
- coordinate function
-
arcsinh()¶ Inverse hyperbolic sine of
self.OUTPUT:
- coordinate function
, where
is the current
coordinate function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.arcsinh() Traceback (most recent call last): ... NotImplementedError: <abstract method arcsinh at 0x...>
- coordinate function
-
arctan()¶ Arc tangent of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.arctan() Traceback (most recent call last): ... NotImplementedError: <abstract method arctan at 0x...>
- coordinate function
-
arctanh()¶ Inverse hyperbolic tangent of
self.OUTPUT:
- coordinate function
, where
is the current
coordinate function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.arctanh() Traceback (most recent call last): ... NotImplementedError: <abstract method arctanh at 0x...>
- coordinate function
-
chart()¶ Return the chart with respect to which
selfis defined.OUTPUT:
- a
Chart
EXAMPLE:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: f = X.function(1+x+y^2) sage: f.chart() Chart (M, (x, y)) sage: f.chart() is X True
- a
-
copy()¶ Return an exact copy of the object.
OUTPUT:
- an instance of
CoordFunction
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.copy() Traceback (most recent call last): ... NotImplementedError: <abstract method copy at 0x...>
- an instance of
-
cos()¶ Cosine of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.cos() Traceback (most recent call last): ... NotImplementedError: <abstract method cos at 0x...>
- coordinate function
-
cosh()¶ Hyperbolic cosine of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.cosh() Traceback (most recent call last): ... NotImplementedError: <abstract method cosh at 0x...>
- coordinate function
-
diff(coord)¶ Return the partial derivative of
selfwith respect to a coordinate.INPUT:
coord– either the coordinate
with respect
to which the derivative of the coordinate function
is to be
taken, or the index
labelling this coordinate (with the
index convention defined on the chart domain via the parameter
start_index)
OUTPUT:
- instance of
CoordFunctionrepresenting the partial derivative
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.diff(x) Traceback (most recent call last): ... NotImplementedError: <abstract method diff at 0x...>
-
disp()¶ Display the function in arrow notation.
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.display() Traceback (most recent call last): ... NotImplementedError: <abstract method display at 0x...>
-
display()¶ Display the function in arrow notation.
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.display() Traceback (most recent call last): ... NotImplementedError: <abstract method display at 0x...>
-
exp()¶ Exponential of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function.
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.exp() Traceback (most recent call last): ... NotImplementedError: <abstract method exp at 0x...>
- coordinate function
-
expr()¶ Return some data that, along with the chart, is sufficient to reconstruct the object.
For a symbolic coordinate function, this returns the symbol expression representing the function (see
sage.manifolds.coord_func_symb.CoordFunctionSymb.expr())TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.expr() Traceback (most recent call last): ... NotImplementedError: <abstract method expr at 0x...>
-
is_zero()¶ Return
Trueif the function is zero andFalseotherwise.TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.is_zero() Traceback (most recent call last): ... NotImplementedError: <abstract method is_zero at 0x...>
-
log(base=None)¶ Logarithm of
self.INPUT:
base– (default:None) base of the logarithm; if None, the natural logarithm (i.e. logarithm to base e) is returned
OUTPUT:
- coordinate function
, where
is the current coordinate
function and
is the base
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.log() Traceback (most recent call last): ... NotImplementedError: <abstract method log at 0x...>
-
scalar_field(name=None, latex_name=None)¶ Construct the scalar field that has
selfas coordinate expression.The domain of the scalar field is the open subset covered by the chart on which
selfis defined.INPUT:
name– (default:None) name given to the scalar fieldlatex_name– (default:None) LaTeX symbol to denote the scalar field; ifNone, the LaTeX symbol is set toname
OUTPUT:
EXAMPLES:
Construction of a scalar field on a 2-dimensional manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: c_xy.<x,y> = M.chart() sage: fc = c_xy.function(x+2*y^3) sage: f = fc.scalar_field() ; f Scalar field on the 2-dimensional topological manifold M sage: f.display() M --> R (x, y) |--> 2*y^3 + x sage: f.coord_function(c_xy) is fc True
-
sin()¶ Sine of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.sin() Traceback (most recent call last): ... NotImplementedError: <abstract method sin at 0x...>
- coordinate function
-
sinh()¶ Hyperbolic sine of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.sinh() Traceback (most recent call last): ... NotImplementedError: <abstract method sinh at 0x...>
- coordinate function
-
sqrt()¶ Square root of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.sqrt() Traceback (most recent call last): ... NotImplementedError: <abstract method sqrt at 0x...>
- coordinate function
-
tan()¶ Tangent of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.tan() Traceback (most recent call last): ... NotImplementedError: <abstract method tan at 0x...>
- coordinate function
-
tanh()¶ Hyperbolic tangent of
self.OUTPUT:
- coordinate function
, where
is the current coordinate
function
TESTS:
This method must be implemented by derived classes; it is not implemented here:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: from sage.manifolds.coord_func import CoordFunction sage: f = CoordFunction(X.function_ring()) sage: f.tanh() Traceback (most recent call last): ... NotImplementedError: <abstract method tanh at 0x...>
- coordinate function
-
class
sage.manifolds.coord_func.MultiCoordFunction(chart, expressions)¶ Bases:
sage.structure.sage_object.SageObjectCoordinate function to some Cartesian power of the base field.
If
and
are two positive integers and
is a chart on
a topological manifold
of dimension
over a topological field
,
a multi-coordinate function associated to
is a map
where
is the codomain of
. In other words,
is a
-valued function of the coordinates associated to the chart
. Each component
(
) is a coordinate
function and is therefore stored as a
CoordFunction.INPUT:
chart– the chart
expressions– list (or tuple) of length
of elements to
construct the coordinate functions
(
); for
symbolic coordinate functions, this must be symbolic expressions
involving the chart coordinates, while for numerical coordinate
functions, this must be data file names
EXAMPLES:
A function
:sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y)); f Coordinate functions (x - y, x*y, cos(x)*e^y) on the Chart (M, (x, y)) sage: type(f) <class 'sage.manifolds.coord_func.MultiCoordFunction'> sage: f(x,y) (x - y, x*y, cos(x)*e^y) sage: latex(f) \left(x - y, x y, \cos\left(x\right) e^{y}\right)
Each real-valued function
(
) composing
can
be accessed via the square-bracket operator, by providing
as an
argument:sage: f[0] x - y sage: f[1] x*y sage: f[2] cos(x)*e^y
We can give a more verbose explanation of each function:
sage: f[0].display() (x, y) |--> x - y
Each
f[i-1]is an instance ofCoordFunction:sage: isinstance(f[0], sage.manifolds.coord_func.CoordFunction) True
In the present case,
f[i-1]is an instance of the subclassCoordFunctionSymb:sage: type(f[0]) <class 'sage.manifolds.coord_func_symb.CoordFunctionSymbRing_with_category.element_class'>
A class
MultiCoordFunctioncan represent a real-valued function (case
), although one should
rather employ the class CoordFunctionfor this purpose:sage: g = X.multifunction(x*y^2) sage: g(x,y) (x*y^2,)
Evaluating the functions at specified coordinates:
sage: f(1,2) (-1, 2, cos(1)*e^2) sage: var('a b') (a, b) sage: f(a,b) (a - b, a*b, cos(a)*e^b) sage: g(1,2) (4,)
-
chart()¶ Return the chart with respect to which
selfis defined.OUTPUT:
- a
Chart
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y)) sage: f.chart() Chart (M, (x, y)) sage: f.chart() is X True
- a
-
expr()¶ Return a tuple of data, the item no.`i` begin sufficient to reconstruct the coordinate function no.
.In other words, if
fis a multi-coordinate function, thenf.chart().multifunction(*(f.expr()))results in a multi-coordinate function identical tof.For a symbolic multi-coordinate function,
expr()returns the tuple of the symbolic expressions of the coordinate functions composing the object.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y)) sage: f.expr() (x - y, x*y, cos(x)*e^y) sage: type(f.expr()[0]) <type 'sage.symbolic.expression.Expression'>
One shall always have:
sage: f.chart().multifunction(*(f.expr())) == f True
-
jacobian()¶ Return the Jacobian matrix of the system of coordinate functions.
jacobian()is a 2-dimensional array of size
,
where
is the number of functions and
the number of
coordinates, the generic element being
with
(row index) and
(column index).OUTPUT:
- Jacobian matrix as a 2-dimensional array
Jof coordinate functions withJ[i-1][j-1]being
for
and 
EXAMPLES:
Jacobian of a set of 3 functions of 2 coordinates:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: f = X.multifunction(x-y, x*y, y^3*cos(x)) sage: f.jacobian() [ 1 -1] [ y x] [ -y^3*sin(x) 3*y^2*cos(x)]
Each element of the result is a
coordinate function:sage: type(f.jacobian()[2,0]) <class 'sage.manifolds.coord_func_symb.CoordFunctionSymbRing_with_category.element_class'> sage: f.jacobian()[2,0].display() (x, y) |--> -y^3*sin(x)
Test of the computation:
sage: [[f.jacobian()[i,j] == f[i].diff(j) for j in range(2)] for i in range(3)] [[True, True], [True, True], [True, True]]
Test with
start_index = 1:sage: M = Manifold(2, 'M', structure='topological', start_index=1) sage: X.<x,y> = M.chart() sage: f = X.multifunction(x-y, x*y, y^3*cos(x)) sage: f.jacobian() [ 1 -1] [ y x] [ -y^3*sin(x) 3*y^2*cos(x)] sage: [[f.jacobian()[i,j] == f[i].diff(j+1) for j in range(2)] # note the j+1 ....: for i in range(3)] [[True, True], [True, True], [True, True]]
- Jacobian matrix as a 2-dimensional array
-
jacobian_det()¶ Return the Jacobian determinant of the system of functions.
The number
of coordinate functions must equal the number
of coordinates.OUTPUT:
- a
CoordFunctionrepresenting the determinant
EXAMPLES:
Jacobian determinant of a set of 2 functions of 2 coordinates:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: f = X.multifunction(x-y, x*y) sage: f.jacobian_det() x + y
The output of
jacobian_det()is an instance ofCoordFunctionand can therefore be called on specific values of the coordinates, e.g.
:sage: type(f.jacobian_det()) <class 'sage.manifolds.coord_func_symb.CoordFunctionSymbRing_with_category.element_class'> sage: f.jacobian_det().display() (x, y) |--> x + y sage: f.jacobian_det()(1,2) 3
The result is cached:
sage: f.jacobian_det() is f.jacobian_det() True
We verify the determinant of the Jacobian:
sage: f.jacobian_det() == det(matrix([[f[i].diff(j).expr() for j in range(2)] ....: for i in range(2)])) True
Jacobian determinant of a set of 3 functions of 3 coordinates:
sage: M = Manifold(3, 'M', structure='topological') sage: X.<x,y,z> = M.chart() sage: f = X.multifunction(x*y+z^2, z^2*x+y^2*z, (x*y*z)^3) sage: f.jacobian_det().display() (x, y, z) |--> 6*x^3*y^5*z^3 - 3*x^4*y^3*z^4 - 12*x^2*y^4*z^5 + 6*x^3*y^2*z^6
We verify the determinant of the Jacobian:
sage: f.jacobian_det() == det(matrix([[f[i].diff(j).expr() for j in range(3)] ....: for i in range(3)])) True
- a
