Merge pull request #4 from italmassov/master
proposing solution to question 52, although trivial
This commit is contained in:
11
README.rst
11
README.rst
@@ -1,4 +1,4 @@
|
|||||||
===================
|
===================
|
||||||
100 numpy exercises
|
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]) ?
|
how to compute distance from each point j (P[j]) to each line i (P0[i],P1[i]) ?
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
# Author: Italmassov Kuanysh
|
||||||
Answer needed actually
|
# 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
|
#. 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
|
fixed shape and centered on a given element (pad with a ``fill`` value when
|
||||||
|
|||||||
Reference in New Issue
Block a user