#If A^2 is defined then A is necessarily square 
A=matrix([[1 , 2],[3 , 4]])
print A
print A*A
B=matrix([[1 , 2],[3 , 4],[3,4]])
print B*B
#B must be square matrix
output:

[1 2]
[3 4]
[ 7 10]
[15 22]
Traceback (click to the left of this block for traceback)
...
IndexError: Number of columns of self must equal number of rows of
right.

Strang-1.4-40-U (last edited 2010-12-17 10:49:22 by sree123)