Commit dfd9db9d authored by Maximilian Vitz's avatar Maximilian Vitz
Browse files

Updated Lecture 2 and Lecture 3

parent 0473dcd0
{
"cells": [
{
"cell_type": "markdown",
"id": "4e98befd-a710-4193-9393-d52d8a7fbcc3",
"metadata": {
"tags": []
},
"source": [
"## Poisson distribution\n",
"$$ P(k; \\lambda) = \\frac{\\lambda^k}{k!} \\mbox{e}^{-\\lambda}$$"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "9c2b256c-333a-4b6c-8241-523b8aeb919f",
"metadata": {},
"outputs": [],
"source": [
"from scipy.stats import poisson, binom"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "ccf39158-28be-4ba4-a898-a5b14be924e1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.18495897346170082"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"poisson.pmf(2,3.5)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "6643ab02-3c24-40b8-90e2-c0ffab308f16",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3208471988621341"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"poisson.pmf(0,3.5)+poisson.pmf(1,3.5)+poisson.pmf(2,3.5)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "19fc9d45-64f9-4e0f-adab-b044c59a083e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.32084719886213414"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"poisson.cdf(2,3.5)"
]
},
{
"cell_type": "markdown",
"id": "9d2578c1-302c-4ea4-8308-8c80d5ab9288",
"metadata": {},
"source": [
"## Binomial distribution\n",
"$$ B(k;N,p) = \\left( \\begin{array}{c} N \\\\ k \\\\ \\end{array} \\right) p^k (1-p)^{N-k} $$"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "a9d78b0f-49ca-44c8-964b-ab1d593ce540",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.2334744405"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"binom.pmf(2,10,0.3)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "4c029640-fec5-4aeb-9644-7e965b0dcbee",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3827827864000002"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"binom.pmf(0,10,0.3)+binom.pmf(1,10,0.3)+binom.pmf(2,10,0.3)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "fa781bea-3265-4915-b299-0870a76b8053",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3827827864"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"binom.cdf(2,10,0.3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a88c9312-41d1-44ba-b600-ca8fcbbb5c75",
"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.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:4e98befd-a710-4193-9393-d52d8a7fbcc3 tags:
## Poisson distribution
$$ P(k; \lambda) = \frac{\lambda^k}{k!} \mbox{e}^{-\lambda}$$
%% Cell type:code id:9c2b256c-333a-4b6c-8241-523b8aeb919f tags:
``` python
from scipy.stats import poisson, binom
```
%% Cell type:code id:ccf39158-28be-4ba4-a898-a5b14be924e1 tags:
``` python
poisson.pmf(2,3.5)
```
%%%% Output: execute_result
0.18495897346170082
%% Cell type:code id:6643ab02-3c24-40b8-90e2-c0ffab308f16 tags:
``` python
poisson.pmf(0,3.5)+poisson.pmf(1,3.5)+poisson.pmf(2,3.5)
```
%%%% Output: execute_result
0.3208471988621341
%% Cell type:code id:19fc9d45-64f9-4e0f-adab-b044c59a083e tags:
``` python
poisson.cdf(2,3.5)
```
%%%% Output: execute_result
0.32084719886213414
%% Cell type:markdown id:9d2578c1-302c-4ea4-8308-8c80d5ab9288 tags:
## Binomial distribution
$$ B(k;N,p) = \left( \begin{array}{c} N \\ k \\ \end{array} \right) p^k (1-p)^{N-k} $$
%% Cell type:code id:a9d78b0f-49ca-44c8-964b-ab1d593ce540 tags:
``` python
binom.pmf(2,10,0.3)
```
%%%% Output: execute_result
0.2334744405
%% Cell type:code id:4c029640-fec5-4aeb-9644-7e965b0dcbee tags:
``` python
binom.pmf(0,10,0.3)+binom.pmf(1,10,0.3)+binom.pmf(2,10,0.3)
```
%%%% Output: execute_result
0.3827827864000002
%% Cell type:code id:fa781bea-3265-4915-b299-0870a76b8053 tags:
``` python
binom.cdf(2,10,0.3)
```
%%%% Output: execute_result
0.3827827864
%% Cell type:code id:a88c9312-41d1-44ba-b600-ca8fcbbb5c75 tags:
``` python
```
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"T0=1\n",
"sigT=0.2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### error propagation"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"error propagation: freq 1.0 +/- 0.2\n"
]
}
],
"source": [
"f0=1/T0\n",
"sigf=1/T0**2 * sigT\n",
"print(\"error propagation: freq \",f0,\" +/- \",sigf)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### simulation"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"T=np.random.normal(T0,sigT,1000)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([ 13., 52., 116., 158., 215., 197., 139., 80., 19., 11.]),\n",
" array([0.48111168, 0.59232677, 0.70354186, 0.81475695, 0.92597204,\n",
" 1.03718713, 1.14840222, 1.25961732, 1.37083241, 1.4820475 ,\n",
" 1.59326259]),\n",
" <BarContainer object of 10 artists>)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAANGElEQVR4nO3db4xl9V3H8ffHpTRqGwvuQNYFHGxWLSSCdUVi1WwlkX8Ptk2KAU1LGpLVSE1NfMDSB2JiSLYPrMYoNtgSMLEgsbRgwCpBK5pK6WIosCB2hRVWCLuUxtaaYHb5+mAOOO7OMHfm3jt359v3K5nMveeeO+f7Y8N7z5ydeydVhSSpl++a9QCSpMkz7pLUkHGXpIaMuyQ1ZNwlqaGTZj0AwObNm2t+fn7WY0jShvLII4+8XFVzSz12QsR9fn6evXv3znoMSdpQkvz7co95WUaSGjLuktSQcZekhoy7JDVk3CWpIeMuSQ0Zd0lqyLhLUkPGXZIaOiFeoSqtZH73vTM79oE9l8/s2NJaeeYuSQ0Zd0lqyLhLUkPGXZIaMu6S1JBxl6SGjLskNWTcJakh4y5JDRl3SWpoxbgnOTPJ3yV5Ksm+JB8dtp+a5P4kXxs+n7LoOdcn2Z/k6SQXT3MBkqTjjXLmfgT4zap6F3AhcG2Sc4DdwANVtQ14YLjP8NiVwLnAJcBNSTZNY3hJ0tJWjHtVvVhV/zzc/hbwFLAV2AncNux2G/C+4fZO4I6qerWqngX2Axd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FvTxLgbSzE/cj6jrk2VfUgC/MuZyfwp7XgIeAdSbasz3Rrt9K6qupLVfWN4e5DLLzWZEMY4c8M4NeBzwIb4f+xN4ywtok1xLiPbqm3VNh6zD4/DJyS5ItJHknyoXWbbu1GWdcfAu9i4YVojwMfrarX1me8qRtl/RvdNSx8d9JCkq3A+4FPznqWKZhYQ6b19gMdrfiWCiz89/wJ4CLgu4F/SvJQVf3rtIcbwyjruhh4FPh54J3A/Un+oaq+OeXZ1sMo69+wkryXhbj/zKxnmaDfB66rqqML30y2MrGGGPfRjfKWCgeBl6vq28C3kzwInAecyHEfZV0fBvbUwkXA/UmeBX4UeHh9Rpyqtm+VkeTHgE8Bl1bV12c9zwRtB+4Ywr4ZuCzJkar6/EynmoyJNcTLMqMb5S0V7gZ+NslJSb6HhXfCfGqd51ytUdb1HAtnEiQ5HfgR4Jl1nXJ67gE+NPzUzIXAf1bVi7MealxJzgLuAj54gn/nuGpVdXZVzVfVPPAXwK81CTtMsCGeuY+olnlLhSS/Ojz+yap6KskXgMeA14BPVdWb/jjXrI2yLuB3gFuTPM7CZYzrqmpDvO1qktuBHcDmJAeBG4C3wBtru4+Fn5jZD/w3C9+lnPBGWNdvAd8P3DSc4R6pDfJuiiOsbcNaaW2TbIhvPyBJDXlZRpIaMu6S1JBxl6SGjLskNWTcJakh4y5JDRl3SWrofwFjeCFv4/gf5wAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plt.hist(T)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([ 78., 259., 293., 174., 103., 59., 15., 12., 5., 2.]),\n",
" array([0.62764293, 0.77273059, 0.91781824, 1.0629059 , 1.20799356,\n",
" 1.35308122, 1.49816887, 1.64325653, 1.78834419, 1.93343184,\n",
" 2.0785195 ]),\n",
" <BarContainer object of 10 artists>)"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAQQklEQVR4nO3df6zddX3H8edLQOYGmTAupJa6y0zdhGVWd9eRsS0o22DyRzGRpW7BxpDUZbhg4h8W/pguS5OaTF0Wh6YKsSYqayaObjA3ZDpmVPBCKlAq2kkH1zb0+mMTt4Sl5b0/7hc5tuf2nnvPvfecfnw+kpvzPZ/v93u+r9v2++r3fs/3fG+qCklSW1406gCSpOVnuUtSgyx3SWqQ5S5JDbLcJalBp486AMB5551Xk5OTo44hSaeUBx988DtVNdFv3liU++TkJNPT06OOIUmnlCT/Od88T8tIUoMWLPckP5XkgSRfS7IvyZ934+cmuSfJN7vHc3rWuSnJgSSPJ7lyJb8BSdKJBjlyfxZ4fVW9GtgAXJXkUmAbcG9VrQfu7Z6T5GJgM3AJcBVwS5LTViC7JGkeC5Z7zflh9/SM7quATcCubnwXcE03vQm4vaqeraongAPAxuUMLUk6uYHOuSc5Lcle4AhwT1XdD1xQVYcBusfzu8XXAk/1rD7TjR3/mluTTCeZnp2dHeJbkCQdb6Byr6pjVbUBuBDYmOSXT7J4+r1En9fcWVVTVTU1MdH3Sh5J0hIt6mqZqvov4AvMnUt/OskagO7xSLfYDLCuZ7ULgUPDBpUkDW6Qq2Umkry0m34J8DvA14E9wJZusS3And30HmBzkjOTXASsBx5Y5tySpJMY5ENMa4Bd3RUvLwJ2V9U/JvkysDvJ9cCTwLUAVbUvyW7gMeAocENVHVuZ+JKkfjIOv6xjamqq/ITq4Ca33TWybR/ccfXIti3pxyV5sKqm+s3zE6qS1CDLXZIaZLlLUoMsd0lqkOUuSQ2y3CWpQZa7JDXIcpekBlnuktQgy12SGmS5S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ZaaL+xmE/GsRY7EdJzmCu2D9RVXf0WWTs9qNxK/dBbltwJ/BbSU5P8tPM3W1y/xjmfJK5oyKSXAD8IvCtVU05mD3AW7p3+y8F/ruqDo861PGSvBy4A7huDI8uf6SqLqqqyaqaBP4O+JOq+vvRpuprHPajQYx8P+rO998K7K+q98+z2NjtR2N1WqbmuW1Bkj/u5n+4qvYn+SzwMPAc8NGqOullaaPICfwF8LEkjzD3I9u7uiOkVZXkU8DlwHlJZoB3A2f05LybuXf6DwD/y9yR0qobIOefAT/H3JEwwNEawd34Bsg5FhbKOQ770SA5GY/96DLgOuCRJHu7sZuBl/fkHIv9qJe3H5CkBo3baRlJ0jKw3CWpQZa7JDXIcpekBlnuktQgy12SGmS5S1KD/h/fH36MP5XHewAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"f=1/T\n",
"plt.hist(f)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"simulation: freq 1.0321737435939056 +/- 0.2231584633106588\n"
]
}
],
"source": [
"print(\"simulation: freq \",np.mean(f),\" +/- \",np.std(f))"
]
},
{
"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.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:code id: tags:
``` python
import numpy as np
```
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
T0=1
sigT=0.2
```
%% Cell type:markdown id: tags:
### error propagation
%% Cell type:code id: tags:
``` python
f0=1/T0
sigf=1/T0**2 * sigT
print("error propagation: freq ",f0," +/- ",sigf)
```
%%%% Output: stream
error propagation: freq 1.0 +/- 0.2
%% Cell type:markdown id: tags:
### simulation
%% Cell type:code id: tags:
``` python
T=np.random.normal(T0,sigT,1000)
```
%% Cell type:code id: tags:
``` python
plt.hist(T)
```
%%%% Output: execute_result
(array([ 13., 52., 116., 158., 215., 197., 139., 80., 19., 11.]),
array([0.48111168, 0.59232677, 0.70354186, 0.81475695, 0.92597204,
1.03718713, 1.14840222, 1.25961732, 1.37083241, 1.4820475 ,
1.59326259]),
<BarContainer object of 10 artists>)
%%%% Output: display_data
[Hidden Image Output]
%% Cell type:code id: tags:
``` python
f=1/T
plt.hist(f)
```
%%%% Output: execute_result
(array([ 78., 259., 293., 174., 103., 59., 15., 12., 5., 2.]),
array([0.62764293, 0.77273059, 0.91781824, 1.0629059 , 1.20799356,
1.35308122, 1.49816887, 1.64325653, 1.78834419, 1.93343184,
2.0785195 ]),
<BarContainer object of 10 artists>)
%%%% Output: display_data
[Hidden Image Output]
%% Cell type:code id: tags:
``` python
print("simulation: freq ",np.mean(f)," +/- ",np.std(f))
```
%%%% Output: stream
simulation: freq 1.0321737435939056 +/- 0.2231584633106588
%% Cell type:code id: tags:
``` python
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment