================
numpy: Exercises
================
#. Implement a function that takes a ``d`` dimensional vector ``x``
returns their Euclidean norm.
.. hint::
The Euclidean norm of a vector is the square root of its dot product
with itself.
#. Implement a function that takes two ``d`` dimensional vectors ``x`` and ``z``
and returns their Euclidean distance.
.. hint::
Can you re-use the solution of the previous exercise?
#. Implement a function that takes a matrix ``A`` and an integer ``k``, and
returns ``A`` elevated to the ``k`` th power.
#. Write a Python program that plots the data here::
https://drive.google.com/open?id=0B0wILN942aEVVlk4TS1WaDItVU0
Every row has an experiment ID and a value; there are 10 experiments, and
100 values (rows) per experiment. For each experiment, plot its values as a
time series.
The plot the average time series, i.e. the average curve, where the average
is taken over all experiments.
.. hint::
Use ``matplotlib.pyplot`` and the ``plot(x, y)`` function, as done in
the examples above, to plot the ten curves and their mean.
#. Implement the Power Iteration method for finding the largest eigenvalue and
eigenvector of a matrix, as described in the first paragraph of:
https://en.wikipedia.org/wiki/Power_iteration#The_method
Check that it matches the results given by the ``eig()`` method of the
``linalg`` module.
#. Implement the Gram-Schmidt orthogonalization routine, described here:
https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process
#. Given the *iris dataset*, compute the covariance matrix of the petal
lenght and petal widht for the *iris setosa* rows.
.. hint::
The covariance matrix is defined here:
https://en.wikipedia.org/wiki/Covariance_matrix