Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The question was strictly asking how to perform all add-one operations at once. (That print command was of course misplaced in the inner most loop.)

An answer constructs the B-copy already with the right entries. For me works best:

A = random_matrix( QQ, 5, 5 )
B = matrix( QQ, 5, 5, [ A[n,k]+1 for n in range(5) for k in range(5) ] )
print A
print B