1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 10 - Bilinear forms"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Page 363 Example 10.4"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a = [x1 x2]\n",
"b = [y1 y2]\n",
"f(a,b) = x1*y1 + x1*y2 + x2*y1 + x2*y2\n",
"so, f(a,b) = \n",
"[x1 x2] * |1 1| * |y1|\n",
" |1 1| |y2|\n",
"So the matrix of f in standard order basis B = {e1,e2} is:\n",
"[f]B = \n",
"[[1 1]\n",
" [1 1]]\n",
"P = \n",
"[[ 1 1]\n",
" [-1 1]]\n",
"Thus, [f]B = P*[f]B*P\n",
"[f]B = \n",
"[[ 1 -1]\n",
" [-1 1]]\n"
]
}
],
"source": [
"from numpy import array,transpose\n",
"print 'a = [x1 x2]'\n",
"print 'b = [y1 y2]'\n",
"print 'f(a,b) = x1*y1 + x1*y2 + x2*y1 + x2*y2'\n",
"print 'so, f(a,b) = '\n",
"print '[x1 x2] * |1 1| * |y1|'\n",
"print ' |1 1| |y2|'\n",
"print 'So the matrix of f in standard order basis B = {e1,e2} is:'\n",
"fb = array([[1, 1],[1, 1]])\n",
"print '[f]B = \\n',fb\n",
"P = array([[1 ,1],[-1, 1]])\n",
"print 'P = \\n',P\n",
"print 'Thus, [f]B'' = P''*[f]B*P'\n",
"fb1 = transpose(P) * fb * P\n",
"print '[f]B'' = \\n',fb1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Page 365 Example 10.5"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"n = 24.0\n",
"a = 100.0\n",
"b = 40.0\n",
"f(a,b) = 4000.0\n",
"f is non-degenerate billinear form on R**n.\n"
]
}
],
"source": [
"from numpy import random,transpose\n",
"n = round(random.randint(2,90))\n",
"a = round(random.randint(1,n) * 10)#\n",
"b = round(random.randint(1,n) * 10)#\n",
"print 'n = ',n\n",
"print 'a = ',a\n",
"print 'b = ',b\n",
"f = a * transpose(b)\n",
"print 'f(a,b) = ',f\n",
"print 'f is non-degenerate billinear form on R**n.'\n",
"#end"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|