how to get the transformation matrix for a transformation over 4x4 matrices?

asked 2018-11-05 21:26:32 +0200

rlsw gravatar image

updated 2020-06-01 14:37:58 +0200

FrédéricC gravatar image

I have the following transformation:

M = MatrixSpace(QQ,4,4)
def f(m):
    return matrix([
            [m[0][0], m[0][1], m[0][2], m[0][3]],
            [m[1][3], m[1][0], m[1][1], m[1][2]],
            [m[2][2], m[2][3], m[2][0], m[2][1]],
            [m[3][1], m[3][2], m[3][3], m[3][0]]
        ])
print linear_transformation(M, M, f)

This is not working - but I can't figure out what linear_transformation is expecting. How can I get this to work? Is this even possible?

edit retag flag offensive close merge delete

Comments

1

The error message

TypeError: first argument must be a matrix or a vector space, not Full MatrixSpace of 4 by 4 dense matrices over Rational Field

is triggered by

sage: from sage.modules.module import is_VectorSpace
sage: is_VectorSpace(M)
False

which is quite weird, because M is indeed a vector space and moreover Sage recognizes it as such:

sage: M in VectorSpaces(QQ)
True
sage: dim(M)
16

So I would say it is a bug in linear_transformation...

eric_g gravatar imageeric_g ( 2018-11-06 13:25:30 +0200 )edit
1

Why not explicitly using vector spaces, as in the doc string of the method? For instance:

sage: M = QQ^16
sage: L = linear_transformation( M, M, lambda A: A )
sage: L
Vector space morphism represented by the matrix:
[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]

::: many other lines


[0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 1 ...
(more)
dan_fulea gravatar imagedan_fulea ( 2018-11-06 21:26:29 +0200 )edit