# Free module bases¶

The class FreeModuleBasis implements bases on a free module $$M$$ of finite rank over a commutative ring, while the class FreeModuleCoBasis implements the dual bases (i.e. bases of the dual module $$M^*$$).

AUTHORS:

• Eric Gourgoulhon, Michal Bejger (2014-2015): initial version
• Travis Scrimshaw (2016): ABC Basis_abstract and list functionality for bases (trac ticket #20770)

REFERENCES:

• Chap. 10 of R. Godement : Algebra, Hermann (Paris) / Houghton Mifflin (Boston) (1968)
• Chap. 3 of S. Lang : Algebra, 3rd ed., Springer (New York) (2002)
class sage.tensor.modules.free_module_basis.Basis_abstract(fmodule, symbol, latex_symbol, latex_name)

Abstract base class for (dual) bases of free modules.

free_module()

Return the free module of self.

EXAMPLES:

sage: M = FiniteRankFreeModule(QQ, 2, name='M', start_index=1)
sage: e = M.basis('e')
sage: e.free_module() is M
True

class sage.tensor.modules.free_module_basis.FreeModuleBasis(fmodule, symbol, latex_symbol=None)

Basis of a free module over a commutative ring $$R$$.

INPUT:

• fmodule – free module $$M$$ (as an instance of FiniteRankFreeModule)
• symbol – string; a letter (of a few letters) to denote a generic element of the basis
• latex_symbol – (default: None) string; symbol to denote a generic element of the basis; if None, the value of symbol is used

EXAMPLES:

A basis on a rank-3 free module over $$\ZZ$$:

sage: M0 = FiniteRankFreeModule(ZZ, 3, name='M_0')
sage: from sage.tensor.modules.free_module_basis import FreeModuleBasis
sage: e = FreeModuleBasis(M0, 'e') ; e
Basis (e_0,e_1,e_2) on the Rank-3 free module M_0 over the Integer Ring


Instead of importing FreeModuleBasis in the global name space, it is recommended to use the module’s method basis():

sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e') ; e
Basis (e_0,e_1,e_2) on the Rank-3 free module M over the Integer Ring


The individual elements constituting the basis are accessed via the square bracket operator:

sage: e[0]
Element e_0 of the Rank-3 free module M over the Integer Ring
sage: e[0] in M
True


The LaTeX symbol can be set explicitely, as the second argument of basis():

sage: latex(e)
\left(e_0,e_1,e_2\right)
sage: eps = M.basis('eps', r'\epsilon') ; eps
Basis (eps_0,eps_1,eps_2) on the Rank-3 free module M over the Integer
Ring
sage: latex(eps)
\left(\epsilon_0,\epsilon_1,\epsilon_2\right)


The individual elements of the basis are labelled according the parameter start_index provided at the free module construction:

sage: M = FiniteRankFreeModule(ZZ, 3, name='M', start_index=1)
sage: e = M.basis('e') ; e
Basis (e_1,e_2,e_3) on the Rank-3 free module M over the Integer Ring
sage: e[1]
Element e_1 of the Rank-3 free module M over the Integer Ring

dual_basis()

Return the basis dual to self.

OUTPUT:

EXAMPLES:

Dual basis on a rank-3 free module:

sage: M = FiniteRankFreeModule(ZZ, 3, name='M', start_index=1)
sage: e = M.basis('e') ; e
Basis (e_1,e_2,e_3) on the Rank-3 free module M over the Integer Ring
sage: f = e.dual_basis() ; f
Dual basis (e^1,e^2,e^3) on the Rank-3 free module M over the Integer Ring


Let us check that the elements of f are elements of the dual of M:

sage: f[1] in M.dual()
True
sage: f[1]
Linear form e^1 on the Rank-3 free module M over the Integer Ring


and that f is indeed the dual of e:

sage: f[1](e[1]), f[1](e[2]), f[1](e[3])
(1, 0, 0)
sage: f[2](e[1]), f[2](e[2]), f[2](e[3])
(0, 1, 0)
sage: f[3](e[1]), f[3](e[2]), f[3](e[3])
(0, 0, 1)

module()

Return the free module on which the basis is defined.

OUTPUT:

EXAMPLES:

sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: e.module()
Rank-3 free module M over the Integer Ring
sage: e.module() is M
True

new_basis(change_of_basis, symbol, latex_symbol=None)

Define a new module basis from self.

The new basis is defined by means of a module automorphism.

INPUT:

• change_of_basis – instance of FreeModuleAutomorphism describing the automorphism $$P$$ that relates the current basis $$(e_i)$$ (described by self) to the new basis $$(n_i)$$ according to $$n_i = P(e_i)$$
• symbol – string; a letter (of a few letters) to denote a generic element of the basis
• latex_symbol – (default: None) string; symbol to denote a generic element of the basis; if None, the value of symbol is used

OUTPUT:

EXAMPLES:

Change of basis on a vector space of dimension 2:

sage: M = FiniteRankFreeModule(QQ, 2, name='M', start_index=1)
sage: e = M.basis('e')
sage: a = M.automorphism()
sage: a[:] = [[1, 2], [-1, 3]]
sage: f = e.new_basis(a, 'f') ; f
Basis (f_1,f_2) on the 2-dimensional vector space M over the
Rational Field
sage: f[1].display()
f_1 = e_1 - e_2
sage: f[2].display()
f_2 = 2 e_1 + 3 e_2
sage: e[1].display(f)
e_1 = 3/5 f_1 + 1/5 f_2
sage: e[2].display(f)
e_2 = -2/5 f_1 + 1/5 f_2

class sage.tensor.modules.free_module_basis.FreeModuleCoBasis(basis, symbol, latex_symbol=None)

Dual basis of a free module over a commutative ring.

INPUT:

• basis – basis of a free module $$M$$ of which self is the dual (must be an instance of FreeModuleBasis)
• symbol – a letter (of a few letters) to denote a generic element of the cobasis
• latex_symbol – (default: None) symbol to denote a generic element of the cobasis; if None, the value of symbol is used

EXAMPLES:

Dual basis on a rank-3 free module:

sage: M = FiniteRankFreeModule(ZZ, 3, name='M', start_index=1)
sage: e = M.basis('e') ; e
Basis (e_1,e_2,e_3) on the Rank-3 free module M over the Integer Ring
sage: from sage.tensor.modules.free_module_basis import FreeModuleCoBasis
sage: f = FreeModuleCoBasis(e, 'f') ; f
Dual basis (f^1,f^2,f^3) on the Rank-3 free module M over the Integer Ring


Let us check that the elements of f are in the dual of M:

sage: f[1] in M.dual()
True
sage: f[1]
Linear form f^1 on the Rank-3 free module M over the Integer Ring


and that f is indeed the dual of e:

sage: f[1](e[1]), f[1](e[2]), f[1](e[3])
(1, 0, 0)
sage: f[2](e[1]), f[2](e[2]), f[2](e[3])
(0, 1, 0)
sage: f[3](e[1]), f[3](e[2]), f[3](e[3])
(0, 0, 1)