{ "cells": [ { "cell_type": "markdown", "id": "0e44bd91-51a7-4c56-92e5-c196be7941af", "metadata": {}, "source": [ "# [Matrix Analysis'24]: test your installation\n", "[matrix analysis'24]: https://github.com/epfl-lts2/matrix-analysis-2024\n", "\n", "[EPFL LTS2](https://lts2.epfl.ch)" ] }, { "cell_type": "markdown", "id": "81936a03-dd2d-4348-af93-828a107ec5c1", "metadata": {}, "source": [ "This is a mini \"test\" Jupyter notebook to make sure the main packages we'll use are installed.\n", "Run it after following the [installation instructions](https://github.com/epfl-lts2/matrix-analysis-2024#installation)." ] }, { "cell_type": "markdown", "id": "2dc4d30c-4162-4347-9ea1-7bc5249c81ee", "metadata": {}, "source": [ "## Standalone dependencies\n", "\n", "If you get a `command not found` error, try to run `conda install <package-name>` (in the `matrix-analysis-2024` environment, i.e., after `conda activate matrix-analysis-2024`)." ] }, { "cell_type": "code", "execution_count": null, "id": "4737f499-386c-463b-8630-85e7bfac5acc", "metadata": {}, "outputs": [], "source": [ "!conda --version # this will fail on Noto " ] }, { "cell_type": "code", "execution_count": null, "id": "ec0596c7-967b-4399-81da-6602bbdcc17d", "metadata": {}, "outputs": [], "source": [ "!git --version" ] }, { "cell_type": "code", "execution_count": null, "id": "0862c7bf-8ae0-4f9a-b96a-1698e59e4aed", "metadata": {}, "outputs": [], "source": [ "from platform import python_version\n", "\n", "print(python_version())" ] }, { "cell_type": "code", "execution_count": null, "id": "41138a01-2426-4cbf-9661-a7e780f06ef4", "metadata": {}, "outputs": [], "source": [ "!jupyter --version\n", "\n", "!ipython --version\n", "\n", "!jupyter-lab --version\n", "!jupyter-notebook --version" ] }, { "cell_type": "markdown", "id": "e3d1d1b1-f09f-44ad-ba14-726451d9898b", "metadata": {}, "source": [ "## Python packages\n", "\n", "If you get a `ModuleNotFoundError` error, try to run `conda install <package-name>` (in the `matrix-analysis-2023` environment, i.e., after `conda activate matrix-analysis-2024`)." ] }, { "cell_type": "code", "execution_count": null, "id": "a1141b09-2122-4862-8b69-2c9d40187662", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "np.__version__" ] }, { "cell_type": "code", "execution_count": null, "id": "c9537241-0f85-4d72-a62f-039826aa7f8c", "metadata": {}, "outputs": [], "source": [ "import scipy\n", "scipy.__version__" ] }, { "cell_type": "code", "execution_count": null, "id": "3860668d-bb4c-4121-94d5-f4655167afc2", "metadata": {}, "outputs": [], "source": [ "import matplotlib as mpl\n", "mpl.__version__" ] }, { "cell_type": "markdown", "id": "08ef3716-82c6-4d00-bdb8-e9d3225c8b69", "metadata": {}, "source": [ "## Small test" ] }, { "cell_type": "code", "execution_count": null, "id": "0aa07bd9-448b-4ceb-a3d8-15109cb439e1", "metadata": {}, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "id": "734b2128-a529-491b-b75e-71874db8de71", "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "def plot_vect(x, b, xlim, ylim):\n", " '''\n", " function to plot two vectors, \n", " x - the original vector\n", " b - the transformed vector\n", " xlim - the limit for x\n", " ylim - the limit for y\n", " '''\n", " plt.figure(figsize = (10, 6))\n", " plt.quiver(0,0,x[0],x[1],\\\n", " color='k',angles='xy',\\\n", " scale_units='xy',scale=1,\\\n", " label='Original vector')\n", " plt.quiver(0,0,b[0],b[1],\\\n", " color='g',angles='xy',\\\n", " scale_units='xy',scale=1,\\\n", " label ='Transformed vector')\n", " plt.xlim(xlim)\n", " plt.ylim(ylim)\n", " plt.xlabel('X')\n", " plt.ylabel('Y')\n", " plt.legend()\n", " plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "c493443b-930d-49ba-ae19-823e5dae362c", "metadata": {}, "outputs": [], "source": [ "A = np.array([[2, 0],[0, 1]])\n", "\n", "x = np.array([1, 1])\n", "b = np.dot(A, x.T)\n", "plot_vect(x,b,(0,3),(0,2))" ] }, { "cell_type": "code", "execution_count": null, "id": "c6002c2a-1d9c-4ca3-aa11-7f4b5cf0c30a", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.13" } }, "nbformat": 4, "nbformat_minor": 5 }