proposing solution to question 52, although trivial

This commit is contained in:
unknown 2015-08-22 13:01:21 +06:00
parent 7cdef30736
commit 4d72e2e9a8

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