Merge pull request #20 from ibah/master

Fixing issue #19 (syntax errors in ipython notebook in commit 4fa32cb)
This commit is contained in:
Nicolas P. Rougier 2016-09-01 14:34:25 +02:00 committed by GitHub
commit 04b3714fda
2 changed files with 12 additions and 0 deletions

View File

@ -855,7 +855,13 @@
"source": [ "source": [
"A = np.random.randint(0,2,5)\n", "A = np.random.randint(0,2,5)\n",
"B = np.random.randint(0,2,5)\n", "B = np.random.randint(0,2,5)\n",
"\n",
"# Assuming identical shape of the arrays and a tolerance for the comparison of values\n",
"equal = np.allclose(A,B)\n", "equal = np.allclose(A,B)\n",
"print(equal)\n",
"\n",
"# Checking both the shape and the element values, no tolerance (values have to be exactly equal)\n",
"equal = np.array_equal(A,B)\n",
"print(equal)" "print(equal)"
] ]
}, },

View File

@ -387,8 +387,14 @@ np.add.reduce(Z)
```python ```python
A = np.random.randint(0,2,5) A = np.random.randint(0,2,5)
B = np.random.randint(0,2,5) B = np.random.randint(0,2,5)
# Assuming identical shape of the arrays and a tolerance for the comparison of values
equal = np.allclose(A,B) equal = np.allclose(A,B)
print(equal) print(equal)
# Checking both the shape and the element values, no tolerance (values have to be exactly equal)
equal = np.array_equal(A,B)
print(equal)
``` ```
#### 43. Make an array immutable (read-only) (★★☆) #### 43. Make an array immutable (read-only) (★★☆)