Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

Cannot transpose the matrix with x.transpose()

asked 0 years ago

zizzelzi gravatar image

Helllo, im having a probles with matrixes that i do during my studies, i try to transpose the matrixes but it gives me the error

``` AttributeError Traceback (most recent call last) Cell In[17], line 1 ----> 1 A.transpose()

AttributeError: 'NoneType' object has no attribute 'transpose' ```

an the said matrix looks like that A = matrix(2,3,[8,-2,3,5,1,-4])

Preview: (hide)

Comments

Please provide more context, like any lines that might have (re)defined A. If I run consecutive commands A = matrix(2,3,[8,-2,3,5,1,-4]) and A.transpose(), it works as expected.

John Palmieri gravatar imageJohn Palmieri ( 0 years ago )
1

NoneType suggests that A was redefined as None at certain point.

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )
1

Right, perhaps by a command like A = A.swap_columns(0,2). That's why I am asking for more information.

John Palmieri gravatar imageJohn Palmieri ( 0 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 0 years ago

Sébastien gravatar image

updated 0 years ago

I don't understand the error either, but this is what one may do:

sage: A = matrix(2,3,[8,-2,3,5,1,-4])
sage: A
[ 8 -2  3]
[ 5  1 -4]
sage: A.transpose()
[ 8  5]
[-2  1]
[ 3 -4]

Notice also the shortcut:

sage: A.T
[ 8  5]
[-2  1]
[ 3 -4]
Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 0 years ago

Seen: 228 times

Last updated: Oct 15 '24