Skip to content

Commit e5d240c

Browse files
author
sushmit
committed
Sr: adding
1 parent 0de2f56 commit e5d240c

File tree

2 files changed

+224
-28
lines changed

2 files changed

+224
-28
lines changed

.ipynb_checkpoints/Python3_chapter4-checkpoint.ipynb

Lines changed: 91 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"output_type": "stream",
1313
"text": [
1414
"b'\\x16\\r\\r\\n'\n",
15-
"3.5.1 |Anaconda 2.4.1 (x86_64)| (default, Dec 7 2015, 11:24:55) \n",
15+
"3.5.1 |Anaconda 2.5.0 (x86_64)| (default, Dec 7 2015, 11:24:55) \n",
1616
"[GCC 4.2.1 (Apple Inc. build 5577)]\n",
1717
"b'\\x16\\r\\r\\n'\n",
18-
"3.5.1 |Anaconda 2.4.1 (x86_64)| (default, Dec 7 2015, 11:24:55) \n",
18+
"3.5.1 |Anaconda 2.5.0 (x86_64)| (default, Dec 7 2015, 11:24:55) \n",
1919
"[GCC 4.2.1 (Apple Inc. build 5577)]\n",
2020
"b'\\x16\\r\\r\\n'\n"
2121
]
@@ -125,7 +125,7 @@
125125
" return Vec({(r,s) for r in M.D[0] for s in M.D[1]},M.f)\n",
126126
"print(mat2vec(M))\n",
127127
"\n",
128-
"print(transpose(M))"
128+
"print(transpose(M))\n"
129129
]
130130
},
131131
{
@@ -156,12 +156,13 @@
156156
"s = Vec(D , {(2,2): one})\n",
157157
"sol= solve(B, s)\n",
158158
"print(type(sol))\n",
159-
"print(B * sol== s)\n"
159+
"print(B * sol== s)\n",
160+
"\n"
160161
]
161162
},
162163
{
163164
"cell_type": "code",
164-
"execution_count": 4,
165+
"execution_count": 2,
165166
"metadata": {
166167
"collapsed": false
167168
},
@@ -183,7 +184,7 @@
183184
" gnome hoop putty shooter slinky\n",
184185
"--------------------------------\n",
185186
" 240 55 133 90 150\n",
186-
"2.6298729313896003e-25\n"
187+
"3.493707177042817e-26\n"
187188
]
188189
}
189190
],
@@ -212,7 +213,7 @@
212213
},
213214
{
214215
"cell_type": "code",
215-
"execution_count": 5,
216+
"execution_count": 3,
216217
"metadata": {
217218
"collapsed": false
218219
},
@@ -329,7 +330,7 @@
329330
"original_vector = R *find_error(error_syndrome = error_syndrome_var)\n",
330331
"print(original_vector)\n",
331332
"\n",
332-
"# Task 4.4.17\n",
333+
"# Task 4.14.17\n",
333334
"def find_error_matrix(S):\n",
334335
" return coldict2mat([find_error(error_syndrome =col_value)\n",
335336
" for col_value in mat2coldict(S).values()])\n",
@@ -354,9 +355,9 @@
354355
"# Putting it all together \n",
355356
"s = ''.join([chr(i) for i in range(256)])\n",
356357
"print(s)\n",
357-
"# Task 4.4.18\n",
358+
"# Task 4.14.18\n",
358359
"bits2str(str2bits('This is test'))\n",
359-
"# Task 4.4.19\n",
360+
"# Task 4.14.19\n",
360361
"print(bits2str(mat2bits(bits2mat(str2bits('This')))))\n",
361362
"\n",
362363
"# Task 4.14.10\n",
@@ -374,11 +375,70 @@
374375
},
375376
{
376377
"cell_type": "code",
377-
"execution_count": null,
378+
"execution_count": 4,
378379
"metadata": {
379380
"collapsed": false
380381
},
381-
"outputs": [],
382+
"outputs": [
383+
{
384+
"name": "stdout",
385+
"output_type": "stream",
386+
"text": [
387+
"\n",
388+
" 5\n",
389+
" ----\n",
390+
" a | 3\n",
391+
" b | 9\n",
392+
" c | 13\n",
393+
"\n",
394+
"\n",
395+
" False True\n",
396+
" ------------\n",
397+
" ((),) | 0 2\n",
398+
" 7 | 1 0\n",
399+
"\n",
400+
"\n",
401+
" a\n",
402+
" ---\n",
403+
" 1 | 6\n",
404+
" 3 | 0\n",
405+
" 5 | 2\n",
406+
"\n",
407+
"False\n",
408+
"('b', 'A')\n",
409+
"('a', 'B')\n",
410+
"('b', 'B')\n",
411+
"0\n",
412+
"True\n",
413+
"True\n",
414+
"({'b', 'a'}, {'B', 'A'})\n",
415+
"Addition starts\n",
416+
"True\n",
417+
"True\n",
418+
"True\n",
419+
"True\n",
420+
"True\n",
421+
"Testing Mat * Vec\n",
422+
"True\n",
423+
"True\n",
424+
"True\n",
425+
"True\n",
426+
"True\n",
427+
"Testing Vec* Mat\n",
428+
"True\n",
429+
"True\n",
430+
"True\n",
431+
"True\n",
432+
"True\n",
433+
"testing for mat * mat\n",
434+
"True\n",
435+
"True\n",
436+
"True\n",
437+
"True\n",
438+
"True\n"
439+
]
440+
}
441+
],
382442
"source": [
383443
"\n",
384444
"# Problem 4.7.12\n",
@@ -495,11 +555,28 @@
495555
},
496556
{
497557
"cell_type": "code",
498-
"execution_count": null,
558+
"execution_count": 5,
499559
"metadata": {
500560
"collapsed": false
501561
},
502-
"outputs": [],
562+
"outputs": [
563+
{
564+
"name": "stdout",
565+
"output_type": "stream",
566+
"text": [
567+
"15\n",
568+
"5\n",
569+
"0\n",
570+
"0\n",
571+
"\n",
572+
" c d\n",
573+
" ------\n",
574+
" a | 0 5\n",
575+
" b | 0 15\n",
576+
"\n"
577+
]
578+
}
579+
],
503580
"source": [
504581
"E = Mat(({'a','b'},{'A','B'}), {('a','A'):1,('a','B'):2,('b','A'):3,('b','B'):4})\n",
505582
"F = Mat(({'A','B'},{'c','d'}),{('A','d'):5})\n",

0 commit comments

Comments
 (0)