Ask Your Question

Linear Transformation Matrix is Transposed

asked 2014-05-05 13:53:17 +0200

jaia gravatar image

updated 2014-05-06 05:55:28 +0200

tmonteil gravatar image

I define a linear transformation object using the following syntax:

def f(v):
    l1 = [2*v[0]+3*v[1], 5*v[0]-v[1]]
    v1 = vector(l1)

lf = linear_transformation(RR^2, RR^2, f)

The output includes the matrix [[2, 5], [3,-1]] instead of [[2,3], [5,-1]]. Is this a bug or am I doing something wrong?

EDIT: Specifying side="right" doesn't help.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2014-05-05 17:10:47 +0200

tmonteil gravatar image

updated 2014-05-06 06:25:39 +0200

Both f and lf are maps, not matrices. Ther is no ambiguity on the side of the action. The side option only applies on linear_transformation() when it is built from a matrix (there is an ambiguity since a matrix creates two linear maps depending on whether one consider the action on the left or on the right). In Sage, the matrix are by default acting on the right (i mean vectors are on the left, see for example the .kernel() method), which is what you see in the representation of lf. There is no problem here:

sage: f([0,1])
(3, -1)
sage: lf([0,1])
(3.00000000000000, -1.00000000000000)
sage: f([1,0])
(2, 5)
sage: lf([1,0])
(2.00000000000000, 5.00000000000000)

Now, if you want the matrix associated to the linear map lf with respect to the canonical basis, you can ask:

sage: lf.matrix(side='right')
[ 2.00000000000000  3.00000000000000]
[ 5.00000000000000 -1.00000000000000]


sage: lf.matrix(side='left')
[ 2.00000000000000  5.00000000000000]
[ 3.00000000000000 -1.00000000000000]

depending on whether you want the matrix to act on the left or on the right.

edit flag offensive delete link more


Okay, now I see why I was on the 'right' track but it didn't help. Nice exposé of this!

kcrisman gravatar imagekcrisman ( 2014-05-06 11:58:37 +0200 )edit

answered 2014-05-05 14:15:52 +0200

kcrisman gravatar image

Note this is the transpose of the matrix you wanted. You may want to read the documentation carefully - you may want side='right', I suppose.

edit flag offensive delete link more


Tried that. It doesn't work.

jaia gravatar imagejaia ( 2014-05-05 14:17:17 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-05-05 13:53:17 +0200

Seen: 878 times

Last updated: May 06 '14