diff options
Diffstat (limited to 'PBS2/Untitled.ipynb')
| -rw-r--r-- | PBS2/Untitled.ipynb | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/PBS2/Untitled.ipynb b/PBS2/Untitled.ipynb new file mode 100644 index 0000000..4a1f52c --- /dev/null +++ b/PBS2/Untitled.ipynb @@ -0,0 +1,90 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "9b604e23-db98-4106-b0c0-74e72625dfd5", + "metadata": {}, + "source": [ + "# Exercice 1\n", + "$n>=2, n \\in \\mathbb{N}, X_1, X_2,\\dots, X_n$ des VAR mutuellement indépendantes de loi $\\mathcal{B}(p)$, $p \\in ]0;1[$\n", + "\n", + "## 1\n", + "$$\n", + "S_n = \\sum_{i=1}^{N}X_i\n", + "$$\n", + "$S_n$ suit une loi Binomiale\n", + "\n", + "## 2\n", + "$S_n \\approx \\mathcal{P}(1)$\n", + "\n", + "## 3\n" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "da4ff45a-49e3-4b51-904d-2cdd31a1b2ff", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0.7 0. 0.9 0.4 0.8 0.5 0.2 1. 0.7 0.3 0.1 0.3 0. 0. 0. 0.1 0. 0.3\n", + " 0.8 0.2 0.1 0.9 0.2 0.5 0.3 0.3 0.8 0.4 0.5 1. 0.4 0.3 0.2 0.9 0.4 0.6\n", + " 0.7 0.7 1. 0.1 0.5 0.4 0. 0.7 0. 0.2 0.3 0. 0.1 0.6]\n", + "18\n" + ] + } + ], + "source": [ + "import random\n", + "import numpy as np\n", + "\n", + "n = 50 #int(input(\"nombre essais\"))\n", + "p = 0.3 #float(input(\"proba succès générique\"))\n", + "def binom(n, p):\n", + " U = np.zeros(n)\n", + " for k in range(n):\n", + " U[k] = random.randint(0,10) / 10\n", + " S = sum([U[i] < p for i in range(n)])\n", + " return S" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "f89c7bbe-ad75-4c23-a504-4b9c36df0895", + "metadata": {}, + "outputs": [], + "source": [ + "def poiss(l):\n", + " n = 1e6\n", + " p = l/n\n", + " X = Binom(n,p)\n", + " return X" + ] + } + ], + "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.13.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} |
