{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "# Exemple : afficher la convergence de l'estimation de π\n", "import numpy as np\n", "\n", "n_values = np.arange(1000, 20000, 1000)\n", "pi_estimations = [buffon_needle(n) for n in n_values]\n", "\n", "plt.plot(n_values, pi_estimations)\n", "plt.axhline(y=math.pi, color='r', linestyle='--', label='π réel')\n", "plt.xlabel(\"Nombre d'expériences\")\n", "plt.ylabel(\"Estimation de π\")\n", "plt.legend()\n", "plt.title(\"Convergence de la méthode de Buffon\")\n", "plt.show()\n" ] } ], "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": 2 }