Ask Your Question

Create random matrices in SageMath

asked 2016-11-02 18:11:04 -0500

kathy reyes gravatar image

updated 2017-01-05 15:13:00 -0500

FrédéricC gravatar image

Create two random 7 × 7 integer matrices A and B. Check whether any of the following identities hold or not: 1. det(AB) = det(A) det(B)

  1. det(A + B) = det(A) + det(B) 3. det(A−1)=1/det(A)

  2. det ([ A 0 ]) = det(A) det(B)(the 0 denote 7 × 7 zero matrices) 0B

edit retag flag offensive close merge delete


What have you tried? Woudl it be possible for you to post some of your code. Didi you look at this question? Here's some simply code to help you generate a 7 x 7 matrix with some random integers B = matrix(7,7, sample(xrange(100), 49)); B however, I am not sure that this is what you are looking for. If you specific and post code I'll be happy to try to help you!

etb gravatar imageetb ( 2016-11-03 03:39:07 -0500 )edit

Have you tried the random_matrix command?

John Palmieri gravatar imageJohn Palmieri ( 2016-11-03 12:32:52 -0500 )edit

Are you just copying a homework problem? It looks very much like it. Have you searched the web? Usually adding "sagemath" to your query gives very good results, for instance search [random matrix sagemath].

slelievre gravatar imageslelievre ( 2016-11-04 02:34:17 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2016-11-03 12:46:06 -0500

ndomes gravatar image

Define a 7x7 random matrix (you must give the base ring (in my example integer ring (ZZ)):

A = random_matrix(ZZ,7,7)

Zero matrix:

O = zero_matrix(7,7)


O = matrix(7,7,0)

Identity matrix:

E = identity_matrix(7,7)


E = matrix(7,7,1)
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


Asked: 2016-11-02 18:10:17 -0500

Seen: 430 times

Last updated: Nov 04 '16