# Chapter 10 - Bilinear forms¶

## Page 363 Example 10.4¶

In [1]:
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

a = [x1 x2]
b = [y1 y2]
f(a,b) = x1*y1 + x1*y2 + x2*y1 + x2*y2
so, f(a,b) =
[x1  x2]  *  |1   1|  *   |y1|
|1   1|     |y2|
So the matrix of f in standard order basis B = {e1,e2} is:
[f]B =
[[1 1]
[1 1]]
P =
[[ 1  1]
[-1  1]]
Thus, [f]B = P*[f]B*P
[f]B =
[[ 1 -1]
[-1  1]]


## Page 365 Example 10.5¶

In [2]:
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

n =  24.0
a =  100.0
b =  40.0
f(a,b) =  4000.0
f is non-degenerate billinear form on R**n.