Ask Your Question
1

How to force a matrix display accordingly?

asked 2018-07-10 00:55:28 +0200

Chernoxyl gravatar image

updated 2018-07-10 17:11:05 +0200

I am working with matrix groups in small and large dimensions (>20 or >100). Is there a way to fleece sage to make a matrix display as “ d x d matrix over <ring>” where d>20? It does not do this for any matrix groups like Coxeter/Affine/Weyl/Braid TL Rep. etc.

CoxeterGroup([‘A20’]).gens()[0]
“21 x 21 matrix over Integer Ring”
edit retag flag offensive close merge delete

Comments

Could you include a very concrete example of the desired input and output?

slelievre gravatar imageslelievre ( 2018-07-10 12:42:01 +0200 )edit

Thanks for your edit, adding an example. It helps understanding and answering the question.

Please also fix the "curly quotes" (maybe "smart quotes" is turned on in your operating system).

Copy pasting the current

CoxeterGroup([‘A20’]).gens()[0]

results in an error, while with straight quotes it works:

CoxeterGroup(['A20']).gens()[0]
slelievre gravatar imageslelievre ( 2018-07-10 18:24:06 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-07-10 18:20:10 +0200

slelievre gravatar image

Define the example in the question and call it a:

sage: a = CoxeterGroup(['A20']).gens()[0]

It displays as

sage: a
[-1  1  0  0  0  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  0  0]
[ 0  0  1  0  0  0  0  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]
[ 0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0]
[ 0  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  0  0  0  0  1  0]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1]

Define the same matrix starting from the identity matrix and modifying the first two entries; call that b:

sage: b = identity_matrix(20)
sage: b[0:2, 0:0] = (-1, 1)

Check that a and b define the same matrix:

sage: b == a
True

However b displays differently:

sage: b
20 x 20 dense matrix over Integer Ring
(use the '.str()' method to see the entries)

Get the fuller display of b, showing all its entries, using print:

sage: print(b)
[-1  1  0  0  0  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  0  0]
[ 0  0  1  0  0  0  0  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]
[ 0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0  0  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  0  0  0  0  1  0  0  0]
[ 0  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  0  0  0  0  1  0]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1]

Let us explain this difference in display, and how to get the summary display for a.

Even though a and b have the same entries, they don't have the same "parent"; a is an element in a matrix group while b is an element in a matrix space.

sage: a.parent()
Finite Coxeter group over Integer Ring with Coxeter matrix:
20 x 20 dense matrix over Integer Ring
sage: b.parent()
Full MatrixSpace of 20 by 20 dense matrices over Integer Ring

The difference in display comes from a different implementation of the __repr__ method for elements of matrix groups and elements of matrix spaces: compare a.__repr__?? and b.__repr__??.

To get the summary version for a, one solution is to convert it to a matrix space element.

sage: c = matrix(a)
sage: c
20 x 20 dense matrix over Integer Ring
(use the '.str()' method to see the entries)

To get elements of matrix groups to consistently use the shorter display when they reach 20 rows, one would have to change the __repr__ method of matrix group elements.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-07-10 00:55:28 +0200

Seen: 351 times

Last updated: Jul 10 '18