An invertible linear transformation.
{{{ A = matrix(QQ, [[1, 1, -1, -2, 0], [-3, -2, 1, 4, 7], [2, 2, -1, -3, -4], [-4, -3, 3, 8, 3], [5, 6, -7, -8, 8]]) T = linear_transformation(QQ^5, QQ^5, A, side='right') }}} {{{ T.is_injective() }}} {{{ T.is_surjective() }}} {{{ T.is_invertible() }}} {{{ S = T.inverse() S }}} {{{ comp = S*T comp }}} {{{ comp.is_identity() }}}
Now, an invertible linear transformation defined on a basis, and the resulting inverse linear transformation. We get two “random” bases from nonsingular matrices.
{{{ C = random_matrix(QQ, 7, 7, algorithm='unimodular', upper_bound=99) Cbasis = C.columns() D = random_matrix(QQ, 7, 7, algorithm='unimodular', upper_bound=99) Dbasis = D.columns() }}}Vector spaces with defined user bases.
{{{ Cspace = (QQ^7).subspace_with_basis(Cbasis) Dspace = (QQ^7).subspace_with_basis(Dbasis) }}}The invertible linear transformation defined with images as the basis D.
{{{ T = linear_transformation(Cspace, QQ^7, Dbasis) T }}} {{{ T.is_invertible() }}}Now we simply “turn around” the definition, to make the inverse.
{{{ S = linear_transformation(Dspace, QQ^7, Cbasis) S }}} {{{ S.is_invertible() }}}Composition with vector spaces using different bases does not seem to be working properly. So we just check some random inputs to the composition.
{{{ v = random_vector(QQ, 7) T(S(v)) == v, S(T(v)) == v }}}
Rank is dimension of range (image). Note there are not left/right variants.
{{{ R.image() }}} {{{ R.rank() }}}Nullity is dimension of kernel. Note there are not left/right variants.
{{{ R.kernel() }}} {{{ R.nullity() }}}Note that rank and nullity sum to the dimension of the domain ($6$ here).
{{{ }}}