Merge pull request #4 from italmassov/master

proposing solution to question 52, although trivial
This commit is contained in:
Nicolas P. Rougier 2015-08-22 09:18:17 +02:00
commit 9d8a7ad876

View File

@ -1,4 +1,4 @@
===================
===================
100 numpy exercises
===================
@ -597,9 +597,12 @@ Thanks to Michiaki Ariga, there is now a
how to compute distance from each point j (P[j]) to each line i (P0[i],P1[i]) ?
.. code-block:: python
Answer needed actually
# Author: Italmassov Kuanysh
# based on distance function from previous question
P0 = np.random.uniform(-10, 10, (10,2))
P1 = np.random.uniform(-10,10,(10,2))
p = np.random.uniform(-10, 10, (10,2))
print np.array([distance(P0,P1,p_i) for p_i in p])
#. Consider an arbitrary array, write a function that extract a subpart with a
fixed shape and centered on a given element (pad with a ``fill`` value when