From d2f8f88ac3726eed6816519517862061d07eca04 Mon Sep 17 00:00:00 2001 From: LilianBittar Date: Sat, 29 Apr 2023 21:58:25 +0200 Subject: [PATCH] Solved 3 from handin 1. --- session02/Handin-1.ipynb | 82 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 session02/Handin-1.ipynb diff --git a/session02/Handin-1.ipynb b/session02/Handin-1.ipynb new file mode 100644 index 0000000..f11693b --- /dev/null +++ b/session02/Handin-1.ipynb @@ -0,0 +1,82 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "from scipy.stats import binom\n", + "from scipy.stats import geom\n", + "from scipy.stats import hypergeom\n", + "from scipy.stats import poisson\n", + "from scipy.stats import nbinom\n", + "from scipy.stats import uniform\n", + "import pandas as pd\n", + "import sympy as sp\n", + "from sympy import *\n", + "sp.init_printing()\n", + "import matplotlib.pyplot as plt\n", + "import scipy.integrate as integrate\n", + "import scipy.special as special\n", + "from scipy.integrate import quad\n", + "import numpy as np\n", + "from scipy.misc import derivative\n", + "import math\n", + "from math import *\n", + "from fractions import Fraction\n", + "import fractions\n", + "from IPython.display import display, Math, Latex\n", + "%matplotlib inline\n", + "from IPython.display import Image, HTML" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.3\n", + "0.4\n" + ] + } + ], + "source": [ + "#section 3\n", + "\n", + "result = uniform.cdf(5, 0, 10) - uniform.cdf(2, 0, 10)\n", + "print(result)\n", + "\n", + "# P(X <= 2 given X =< 5 )\n", + "result1 = uniform.cdf(2, 0, 10) / uniform.cdf(5, 0, 10)\n", + "print(result1)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "base", + "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.9" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +}