from numpy import array,transpose
print 'a = [x1 x2]'
print 'b = [y1 y2]'
print 'f(a,b) = x1*y1 + x1*y2 + x2*y1 + x2*y2'
print 'so, f(a,b) = '
print '[x1 x2] * |1 1| * |y1|'
print ' |1 1| |y2|'
print 'So the matrix of f in standard order basis B = {e1,e2} is:'
fb = array([[1, 1],[1, 1]])
print '[f]B = \n',fb
P = array([[1 ,1],[-1, 1]])
print 'P = \n',P
print 'Thus, [f]B'' = P''*[f]B*P'
fb1 = transpose(P) * fb * P
print '[f]B'' = \n',fb1
from numpy import random,transpose
n = round(random.randint(2,90))
a = round(random.randint(1,n) * 10)#
b = round(random.randint(1,n) * 10)#
print 'n = ',n
print 'a = ',a
print 'b = ',b
f = a * transpose(b)
print 'f(a,b) = ',f
print 'f is non-degenerate billinear form on R**n.'
#end