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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 7 - The rational and jordan forms"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Page 239 Example 7.3"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A = \n",
"Matrix([[5, -6, -6], [-1, 4, 2], [3, -6, -4]])\n",
"Characteristic polynomial for linear operator T on R**3 will be:\n",
"f = x**3 - 5*x**2 + 8*x - 4\n",
"or\n",
"(x-1)(x-2)**2\n",
"The minimal polynomial for T is:\n",
"p = (x - 2)*(x - 1)\n",
"or\n",
"p = (x-1)(x-2)\n",
"So in cyclic decomposition of T, a1 will have p as its T-annihilator.\n",
"Another vector a2 that generate cyclic subspace of dimension 1 will have its T-annihilator as p2.\n",
"p2 = x - 2\n",
"pp2 = (x - 2)**2*(x - 1)\n",
"i.e., pp2 = f\n",
"Therefore, A is similar to B\n",
"B = \n",
"[[ 0 -2 0]\n",
" [ 1 3 0]\n",
" [ 0 0 2]]\n",
"Thus, we can see thet Matrix of T in ordered basis is B\n"
]
}
],
"source": [
"from numpy import array\n",
"from sympy import Symbol,Matrix\n",
"A = Matrix(([5, -6, -6],[-1, 4 ,2],[3, -6, -4]))\n",
"print 'A = \\n',A\n",
"x=Symbol('x')\n",
"f = A.charpoly(x).as_expr()\n",
"print 'Characteristic polynomial for linear operator T on R**3 will be:'\n",
"print 'f = ',f\n",
"print 'or'\n",
"print '(x-1)(x-2)**2'\n",
"print 'The minimal polynomial for T is:'\n",
"p = (x-1)*(x-2)#\n",
"print 'p = ',p\n",
"print 'or'\n",
"print 'p = (x-1)(x-2)'\n",
"print 'So in cyclic decomposition of T, a1 will have p as its T-annihilator.'\n",
"print 'Another vector a2 that generate cyclic subspace of dimension 1 will have its T-annihilator as p2.'\n",
"p2 = x-2#\n",
"print 'p2 = ',p2\n",
"print 'pp2 = ',p*p2\n",
"print 'i.e., pp2 = f'\n",
"print 'Therefore, A is similar to B'\n",
"B = array([[0, -2, 0],[1, 3, 0],[0, 0 ,2]])\n",
"print 'B = \\n',B\n",
"print 'Thus, we can see thet Matrix of T in ordered basis is B'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Page 247 Example 7.6"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A = \n",
"2 0 0\n",
"a 2 0\n",
"b c -1\n",
"A = \n",
"Matrix([[2, 0, 0], [1, 2, 0], [0, 0, -1]])\n",
"Characteristic polynomial for A is:\n",
"p = x**3 - 3*x**2 + 4\n",
"In this case, minimal polynomial is same as characteristic polynomial.\n",
"-----------------------------------------\n",
"A = \n",
"Matrix([[2, 0, 0], [0, 2, 0], [0, 0, -1]])\n",
"Characteristic polynomial for A is:\n",
"p = x**3 - 3*x**2 + 4\n",
"In this case, minimal polynomial is: (x-2)(x+1)\n",
"or\n",
"(x - 2)*(x + 1)\n",
"(A-2I)(A+I) = \n",
"0 0 0\n",
"3a 0 0\n",
"ac 0 0\n",
"if a = 0, A is similar to diagonal matrix.\n"
]
}
],
"source": [
"from numpy import array\n",
"from sympy import Symbol,Matrix\n",
"\n",
"print 'A = '\n",
"print '2 0 0'\n",
"print 'a 2 0'\n",
"print 'b c -1'\n",
"a = 1#\n",
"b = 0#\n",
"c = 0#\n",
"A = Matrix(([2, 0, 0],[a, 2, 0],[b, c, -1]))\n",
"print 'A = \\n',A\n",
"print 'Characteristic polynomial for A is:'\n",
"x=Symbol('x')\n",
"print 'p = ',A.charpoly(x).as_expr()\n",
"print 'In this case, minimal polynomial is same as characteristic polynomial.'\n",
"print '-----------------------------------------'\n",
"a = 0#\n",
"b = 0#\n",
"c = 0#\n",
"A = Matrix(([2, 0, 0],[a, 2, 0],[b, c, -1]))\n",
"print 'A = \\n',A\n",
"print 'Characteristic polynomial for A is:'\n",
"x=Symbol('x')\n",
"print 'p = ',A.charpoly(x).as_expr()\n",
"print 'In this case, minimal polynomial is:',\n",
"print '(x-2)(x+1)'\n",
"print 'or'\n",
"s = (x-2)*(x+1)#\n",
"print s\n",
"print '(A-2I)(A+I) = '\n",
"print '0 0 0'\n",
"print '3a 0 0'\n",
"print 'ac 0 0'\n",
"print 'if a = 0, A is similar to diagonal matrix.'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Page 247 Example 7.7"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A = \n",
"2 0 0 0\n",
"1 2 0 0\n",
"0 0 2 0\n",
"0 0 a 2\n",
"Considering a = 1\n",
"Characteristic polynomial for A is:\n",
"p = x**4 - 8*x**3 + 24*x**2 - 32*x + 16\n",
"or\n",
"(x-2)**4\n",
"Minimal polynomial for A =\n",
"(x-2)**2\n",
"For a = 0 and a = 1, characteristic and minimal polynomial are same.\n",
"But for a=0, the solution space of (A - 2I) has 3 dimension whereas for a = 1, it has 2 dimension. \n"
]
}
],
"source": [
"from numpy import array\n",
"from sympy import Symbol,Matrix\n",
"print 'A = '\n",
"print '2 0 0 0'\n",
"print '1 2 0 0'\n",
"print '0 0 2 0'\n",
"print '0 0 a 2'\n",
"print 'Considering a = 1'\n",
"A = Matrix(([2, 0 ,0 ,0],[1, 2, 0, 0],[0, 0 ,2 ,0],[0, 0, 1, 2]))\n",
"x=Symbol('x')\n",
"p = A.charpoly(x).as_expr()\n",
"print 'Characteristic polynomial for A is:'\n",
"print 'p = ',p\n",
"print 'or'\n",
"print '(x-2)**4'\n",
"print 'Minimal polynomial for A ='\n",
"print '(x-2)**2'\n",
"print 'For a = 0 and a = 1, characteristic and minimal polynomial are same.'\n",
"print 'But for a=0, the solution space of (A - 2I) has 3 dimension whereas for a = 1, it has 2 dimension. '"
]
}
],
"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
}
|