Skip to content

Commit dd490d7

Browse files
committed
More Updates Numpy, Sympy for Python 3.6+
1 parent 80dc2d2 commit dd490d7

3 files changed

+44
-66
lines changed

numpy/02.08-Sorting.ipynb

+15-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
{
4444
"cell_type": "code",
4545
"execution_count": 1,
46-
"metadata": {},
46+
"metadata": {
47+
"collapsed": true
48+
},
4749
"outputs": [],
4850
"source": [
4951
"import numpy as np\n",
@@ -90,7 +92,9 @@
9092
{
9193
"cell_type": "code",
9294
"execution_count": 3,
93-
"metadata": {},
95+
"metadata": {
96+
"collapsed": true
97+
},
9498
"outputs": [],
9599
"source": [
96100
"def bogosort(x):\n",
@@ -420,7 +424,9 @@
420424
{
421425
"cell_type": "code",
422426
"execution_count": 14,
423-
"metadata": {},
427+
"metadata": {
428+
"collapsed": true
429+
},
424430
"outputs": [],
425431
"source": [
426432
"X = rand.rand(10, 2)"
@@ -468,7 +474,9 @@
468474
{
469475
"cell_type": "code",
470476
"execution_count": 16,
471-
"metadata": {},
477+
"metadata": {
478+
"collapsed": true
479+
},
472480
"outputs": [],
473481
"source": [
474482
"dist_sq = np.sum((X[:, np.newaxis, :] - X[np.newaxis, :, :]) ** 2, axis=-1)"
@@ -621,7 +629,9 @@
621629
{
622630
"cell_type": "code",
623631
"execution_count": 22,
624-
"metadata": {},
632+
"metadata": {
633+
"collapsed": true
634+
},
625635
"outputs": [],
626636
"source": [
627637
"K = 2\n",

numpy/02.09-Structured-Data-NumPy.ipynb

+27-59
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
{
5858
"cell_type": "code",
5959
"execution_count": 2,
60-
"metadata": {
61-
"collapsed": false
62-
},
60+
"metadata": {},
6361
"outputs": [],
6462
"source": [
6563
"name = ['Alice', 'Bob', 'Cathy', 'Doug']\n",
@@ -80,9 +78,7 @@
8078
{
8179
"cell_type": "code",
8280
"execution_count": 3,
83-
"metadata": {
84-
"collapsed": false
85-
},
81+
"metadata": {},
8682
"outputs": [],
8783
"source": [
8884
"x = np.zeros(4, dtype=int)"
@@ -98,9 +94,7 @@
9894
{
9995
"cell_type": "code",
10096
"execution_count": 4,
101-
"metadata": {
102-
"collapsed": false
103-
},
97+
"metadata": {},
10498
"outputs": [
10599
{
106100
"name": "stdout",
@@ -130,16 +124,14 @@
130124
{
131125
"cell_type": "code",
132126
"execution_count": 5,
133-
"metadata": {
134-
"collapsed": false
135-
},
127+
"metadata": {},
136128
"outputs": [
137129
{
138130
"name": "stdout",
139131
"output_type": "stream",
140132
"text": [
141-
"[('Alice', 25, 55.0) ('Bob', 45, 85.5) ('Cathy', 37, 68.0)\n",
142-
" ('Doug', 19, 61.5)]\n"
133+
"[('Alice', 25, 55. ) ('Bob', 45, 85.5) ('Cathy', 37, 68. )\n",
134+
" ('Doug', 19, 61.5)]\n"
143135
]
144136
}
145137
],
@@ -162,14 +154,12 @@
162154
{
163155
"cell_type": "code",
164156
"execution_count": 6,
165-
"metadata": {
166-
"collapsed": false
167-
},
157+
"metadata": {},
168158
"outputs": [
169159
{
170160
"data": {
171161
"text/plain": [
172-
"array(['Alice', 'Bob', 'Cathy', 'Doug'], \n",
162+
"array(['Alice', 'Bob', 'Cathy', 'Doug'],\n",
173163
" dtype='<U10')"
174164
]
175165
},
@@ -186,14 +176,12 @@
186176
{
187177
"cell_type": "code",
188178
"execution_count": 7,
189-
"metadata": {
190-
"collapsed": false
191-
},
179+
"metadata": {},
192180
"outputs": [
193181
{
194182
"data": {
195183
"text/plain": [
196-
"('Alice', 25, 55.0)"
184+
"('Alice', 25, 55.)"
197185
]
198186
},
199187
"execution_count": 7,
@@ -209,9 +197,7 @@
209197
{
210198
"cell_type": "code",
211199
"execution_count": 8,
212-
"metadata": {
213-
"collapsed": false
214-
},
200+
"metadata": {},
215201
"outputs": [
216202
{
217203
"data": {
@@ -239,14 +225,12 @@
239225
{
240226
"cell_type": "code",
241227
"execution_count": 9,
242-
"metadata": {
243-
"collapsed": false
244-
},
228+
"metadata": {},
245229
"outputs": [
246230
{
247231
"data": {
248232
"text/plain": [
249-
"array(['Alice', 'Doug'], \n",
233+
"array(['Alice', 'Doug'],\n",
250234
" dtype='<U10')"
251235
]
252236
},
@@ -281,9 +265,7 @@
281265
{
282266
"cell_type": "code",
283267
"execution_count": 10,
284-
"metadata": {
285-
"collapsed": false
286-
},
268+
"metadata": {},
287269
"outputs": [
288270
{
289271
"data": {
@@ -311,9 +293,7 @@
311293
{
312294
"cell_type": "code",
313295
"execution_count": 11,
314-
"metadata": {
315-
"collapsed": false
316-
},
296+
"metadata": {},
317297
"outputs": [
318298
{
319299
"data": {
@@ -341,9 +321,7 @@
341321
{
342322
"cell_type": "code",
343323
"execution_count": 12,
344-
"metadata": {
345-
"collapsed": false
346-
},
324+
"metadata": {},
347325
"outputs": [
348326
{
349327
"data": {
@@ -370,9 +348,7 @@
370348
{
371349
"cell_type": "code",
372350
"execution_count": 13,
373-
"metadata": {
374-
"collapsed": false
375-
},
351+
"metadata": {},
376352
"outputs": [
377353
{
378354
"data": {
@@ -424,15 +400,13 @@
424400
{
425401
"cell_type": "code",
426402
"execution_count": 14,
427-
"metadata": {
428-
"collapsed": false
429-
},
403+
"metadata": {},
430404
"outputs": [
431405
{
432406
"name": "stdout",
433407
"output_type": "stream",
434408
"text": [
435-
"(0, [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])\n",
409+
"(0, [[ 0., 0., 0.], [ 0., 0., 0.], [ 0., 0., 0.]])\n",
436410
"[[ 0. 0. 0.]\n",
437411
" [ 0. 0. 0.]\n",
438412
" [ 0. 0. 0.]]\n"
@@ -469,9 +443,7 @@
469443
{
470444
"cell_type": "code",
471445
"execution_count": 15,
472-
"metadata": {
473-
"collapsed": false
474-
},
446+
"metadata": {},
475447
"outputs": [
476448
{
477449
"data": {
@@ -498,9 +470,7 @@
498470
{
499471
"cell_type": "code",
500472
"execution_count": 16,
501-
"metadata": {
502-
"collapsed": false
503-
},
473+
"metadata": {},
504474
"outputs": [
505475
{
506476
"data": {
@@ -528,17 +498,15 @@
528498
{
529499
"cell_type": "code",
530500
"execution_count": 17,
531-
"metadata": {
532-
"collapsed": false
533-
},
501+
"metadata": {},
534502
"outputs": [
535503
{
536504
"name": "stdout",
537505
"output_type": "stream",
538506
"text": [
539-
"1000000 loops, best of 3: 241 ns per loop\n",
540-
"100000 loops, best of 3: 4.61 µs per loop\n",
541-
"100000 loops, best of 3: 7.27 µs per loop\n"
507+
"156 ns ± 9.95 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)\n",
508+
"5.95 µs ± 342 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n",
509+
"8.25 µs ± 235 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
542510
]
543511
}
544512
],
@@ -592,9 +560,9 @@
592560
"name": "python",
593561
"nbconvert_exporter": "python",
594562
"pygments_lexer": "ipython3",
595-
"version": "3.4.3"
563+
"version": "3.6.1"
596564
}
597565
},
598566
"nbformat": 4,
599-
"nbformat_minor": 0
567+
"nbformat_minor": 1
600568
}

sympy/Quantum Algorithms and Machine Learning - Grover's Algorithm.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@
239239
},
240240
{
241241
"cell_type": "code",
242-
"execution_count": 18,
242+
"execution_count": 19,
243243
"metadata": {},
244244
"outputs": [
245245
{
246246
"name": "stdout",
247247
"output_type": "stream",
248248
"text": [
249249
"Cycles : 12.5663706144\n",
250-
"Mesured state: 128\n"
250+
"Measured state: 128\n"
251251
]
252252
}
253253
],

0 commit comments

Comments
 (0)