From e2d2ea8265cfb915e55a20e89ea731eed2f16b11 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 27 Aug 2022 10:59:51 -0700 Subject: [PATCH] src/sage/tensor/modules/finite_rank_free_module.py: isomorphism_with_fixed_basis with codomain=symmetric matrices --- .../tensor/modules/finite_rank_free_module.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/sage/tensor/modules/finite_rank_free_module.py b/src/sage/tensor/modules/finite_rank_free_module.py index 9da331cf3b3..2a84cee63a9 100644 --- a/src/sage/tensor/modules/finite_rank_free_module.py +++ b/src/sage/tensor/modules/finite_rank_free_module.py @@ -846,6 +846,36 @@ def isomorphism_with_fixed_basis(self, basis=None, codomain=None): [2 4 5] [3 5 6] + Same but explicitly in the subspace of symmetric bilinear forms:: + + sage: Sym2Vdual = V.dual_symmetric_power(2); Sym2Vdual + Free module of type-(0,2) tensors + with Fully symmetric 2-indices components w.r.t. (1, 2, 3) + on the 3-dimensional vector space over the Rational Field + sage: Sym2Vdual.is_submodule(T02) + True + sage: Sym2Vdual.rank() + 6 + sage: e_Sym2Vdual = Sym2Vdual.basis("e"); e_Sym2Vdual + Standard basis on the Free module of type-(0,2) tensors + with Fully symmetric 2-indices components w.r.t. (1, 2, 3) + on the 3-dimensional vector space over the Rational Field + induced by Basis (e_1,e_2,e_3) on the 3-dimensional vector space over the Rational Field + sage: W_basis = [phi_e_T02(b) for b in e_Sym2Vdual]; W_basis + [ + [1 0 0] [0 1 0] [0 0 1] [0 0 0] [0 0 0] [0 0 0] + [0 0 0] [1 0 0] [0 0 0] [0 1 0] [0 0 1] [0 0 0] + [0 0 0], [0 0 0], [1 0 0], [0 0 0], [0 1 0], [0 0 1] + ] + sage: W = MatrixSpace(QQ, 3).submodule(W_basis); W + Free module generated by {0, 1, 2, 3, 4, 5} over Rational Field + sage: phi_e_Sym2Vdual = Sym2Vdual.isomorphism_with_fixed_basis(e_Sym2Vdual, codomain=W); phi_e_Sym2Vdual + Generic morphism: + From: Free module of type-(0,2) tensors + with Fully symmetric 2-indices components w.r.t. (1, 2, 3) + on the 3-dimensional vector space over the Rational Field + To: Free module generated by {0, 1, 2, 3, 4, 5} over Rational Field + Sending tensors to elements of the tensor square of :class:`CombinatorialFreeModule`:: sage: T20 = V.tensor_module(2, 0); T20 @@ -909,6 +939,8 @@ def isomorphism_with_fixed_basis(self, basis=None, codomain=None): else: # assume that the keys of the codomain should be used key_pairs = zip(codomain_basis.keys(), basis.keys()) + # Need them several times, can't keep as generators + key_pairs = tuple(key_pairs) def _isomorphism(x): r"""