diff --git a/HW1.ipynb b/HW1.ipynb index dba7747..cabcbb3 100644 --- a/HW1.ipynb +++ b/HW1.ipynb @@ -1,132 +1,144 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework \\#1 - Python exercise" ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Consider the following change of basis matrix in $\\mathbb{C}^8$, with respect to the standard orthonormal basis:\n", " \n", " $$\n", " \\mathbf{H} = \\begin{bmatrix}\n", " 1 & -1 & 0 & 0 & 0 & 0 & 0 & 0\\\\\n", " 0 & 0 & 1 & -1 & 0 & 0 & 0 & 0\\\\\n", " 0 & 0 & 0 & 0 & 1 & -1 & 0 & 0\\\\\n", " 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1\\\\\n", " 1 & 1 & -1 & -1 & 0 & 0 & 0 & 0\\\\\n", " 0 & 0 & 0 & 0 & 1 & 1 & -1 & -1\\\\\n", " 1 & 1 & 1 & 1 & -1 & -1 & -1 & -1\\\\\n", " 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\\\\n", " \\end{bmatrix}.\n", " $$\n", " \n", "* What is an easy way to prove that the rows in $\\mathbf{H}$ do indeed form a basis? (\\emph{Hint}: it's enough to show that they are linearly independent, which is to say, that the matrix has full rank...)\n", "* Use Python to verify point (a); obviously you can use \\texttt{numpy}.\n", "\n", "\n", "The basis described by $\\mathbf{H}$ is called the \\emph{Haar basis} and it is one of the most celebrated cornerstones of a branch of signal processing called wavelet analysis (which we won't study in this class). To get a feeling for its properties, however, consider the following set of Python experiments:\n", "\n", "* Verify that $\\mathbf{H}\\mathbf{H}^H$ is a diagonal matrix, which means the vectors are orthogonal.\n", "* Consider a constant signal $\\mathbf{x} = \\begin{bmatrix}1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\end{bmatrix}$ and compute its coefficients in the Haar basis.\n", "* Consider an alternating signal $\\mathbf{y} = \\begin{bmatrix}1 & -1 & 1 & -1 & 1 & -1 & 1 & -1\\end{bmatrix}$ and compute its coefficients in the Haar basis." ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# 8x8 Haar matrix\n", "H = np.array([\n", " [1, -1, 0, 0, 0, 0, 0, 0],\n", " [0, 0, 1, -1, 0, 0, 0, 0],\n", " [0, 0, 0, 0, 1, -1, 0, 0],\n", " [0, 0, 0, 0, 0, 0, 1, -1],\n", " [1, 1, -1, -1, 0, 0, 0, 0],\n", " [0, 0, 0, 0, 1, 1, -1, -1],\n", " [1, 1, 1, 1, -1, -1, -1, -1],\n", " [1, 1, 1, 1, 1, 1, 1, 1]\n", "])" ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# b) show that the rows are linearly independent\n", "# ..." ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ - "# c) verify that HH^T is symmetric\n", + "# c) verify that HH^T is diagonal\n", "# ..." ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# d) compute a basis expansion\n", "x = np.ones((8,1)) # note that we specify the shape to obtain a column vector\n", "\n", "# ..." ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# e) compute a basis expansion\n", "y = ..." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.7" + "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 4 }