diff --git a/module2/exo1/Untitled.ipynb b/module2/exo1/Untitled.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..202470c07e78e52641d6ac9a4488bd78c630d6be --- /dev/null +++ b/module2/exo1/Untitled.ipynb @@ -0,0 +1,61 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 3)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m3\u001b[0m\n\u001b[0;31m Mon ordinateur m'indique que $\\pi$ vaut *approximativement*\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "source": [ + "# À propos du calcul de $\\pi$\n", + "## En demandant à la lib maths\n", + "Mon ordinateur m'indique que $\\pi$ vaut *approximativement*\n", + "from math import *\n", + "print(pi)\n", + "\n", + "import numpy as np\n", + "np.random.seed(seed=42)\n", + "N = 10000\n", + "x = np.random.uniform(size=N, low=0, high=1)\n", + "theta = np.random.uniform(size=N, low=0, high=pi/2)\n", + "2/(sum((x+np.sin(theta))>1)/N)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.6.4" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}