08: Solve a and b and add a TODO
This commit is contained in:
@ -421,7 +421,38 @@
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"YOUR ANSWER HERE"
|
||||
"**To proof**\n",
|
||||
"\n",
|
||||
"$\\frac{1}{V}\\mathbb{E}[ \\rho_T(r) ] = \\mathbb{P}(d_T(X,Y) = r)$\n",
|
||||
"\n",
|
||||
"**Proof**\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\frac{1}{V} \\mathbb{E}\\left[ \\rho_T(r)\\right]\n",
|
||||
" = \\frac{1}{V} \\mathbb{E} \\left[\\frac{1}{V} \\sum_{x=0}^{V-1}\\sum_{y=0}^{V-1} \\mathbf{1}_{\\{d_T(x,y)=r\\}} \\right]\n",
|
||||
" = \\frac{1}{V^2} \\mathbb{E} \\left[ \\sum_{x=0}^{V-1}\\sum_{y=0}^{V-1} \\mathbf{1}_{\\{d_T(x,y)=r\\}} \\right]\n",
|
||||
" = \\frac{1}{V^2} \\sum_{x=0}^{V-1}\\sum_{y=0}^{V-1} \\mathbb{E} \\left[ \\mathbf{1}_{\\{d_T(x,y)=r\\}} \\right]\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"The order of summation is changed, as the sum of expectation values is equal to the expectation value of the sum.\n",
|
||||
"The latter expectation value of the indicator function is exactly equal to the chance $\\mathbb{P}(d_T(x,y)=r)$ for given $x, y$.\n",
|
||||
"For the uniformly distributed $X, Y$, we find $\\mathbb{P}(X = x) = \\frac{1}{V} = \\mathbb{P}(Y = y)$.\n",
|
||||
"This allows us to write the right hand side as follows.\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\frac{1}{V} \\mathbb{E}\\left[ \\rho_T(r)\\right]\n",
|
||||
" = \\frac{1}{V^2} \\sum_{x=0}^{V-1}\\sum_{y=0}^{V-1} \\mathbb{P}(d_T(x,y)=r)\n",
|
||||
" = \\sum_{x=0}^{V-1}\\sum_{y=0}^{V-1} \\mathbb{P}(X = x) \\mathbb{P}(Y = y) \\mathbb{P}(d_T(x,y)=r)\n",
|
||||
" = \\mathbb{P}(d_T(X,Y)=r),\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"which is what we sought.\n",
|
||||
"\n",
|
||||
"Using this result, it is just a matter of writing out the definition of an expectation value to get to the result.\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\mathbb{E}[d_T(X,Y)] = \\sum_{r=0}^\\infty r\\, \\mathbb{P}(d_T(X,Y) = r) = \\frac{1}{V}\\sum_{r=0}^\\infty r\\, \\mathbb{E}[ \\rho_T(r) ].\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -475,7 +506,36 @@
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"YOUR ANSWER HERE"
|
||||
"**To proof**\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\mathbb{E}[d_T(X,Y)] \\approx c\\,V^{1/d_H}, \\qquad c = \\int_0^\\infty \\mathrm{d}x\\,x\\,f(x)\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"**Proof**\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\mathbb{E} \\left[ d_T(X,Y) \\right]\n",
|
||||
" = \\frac{1}{V} \\sum_{r=0}^\\infty r\\, \\mathbb{E} \\left[ \\rho_T(r) \\right]\n",
|
||||
" = \\frac{1}{V} \\sum_{r=0}^\\infty rV^{1-1/d_H}f(rV^{-1/d_H})\n",
|
||||
" = \\frac{1}{V} \\sum_{r=0}^\\infty xV^{1/d_H} \\cdot V^{1-1/d_H}f(x)\n",
|
||||
" = \\sum_{r=0}^\\infty xf(x),\n",
|
||||
"$$\n",
|
||||
"where the first equality sign is due to (2), the second due to the given assumption, the third using $x = rV^{-1/d_H}$.\n",
|
||||
"\n",
|
||||
"Now we approximate the summation by an integral.\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\sum_{r=0}^\\infty xf(x)\n",
|
||||
" \\approx \\int_{r=0}^\\infty xf(x)dr\n",
|
||||
" = V^{1/d_H} \\int_{x=0}^\\infty xf(x)dx\n",
|
||||
" = cV^{1/d_H},\n",
|
||||
"$$\n",
|
||||
"using $\\frac{dr}{dx} = V^{1/d_H}$ for substitution.\n",
|
||||
"This yields the desired approximation\n",
|
||||
"$$\n",
|
||||
" \\mathbb{E} \\left[ d_T(X,Y) \\right] \\approx cV^{1/d_H}.\n",
|
||||
"$$"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -602,6 +662,7 @@
|
||||
" \n",
|
||||
" for idx_model, model in enumerate(models):\n",
|
||||
" # Calculate mean and standard deviation of the expectations.\n",
|
||||
" # TODO: Look at whether I store the right data and do the right calculations.\n",
|
||||
" mu = np.mean(expectations[model], 1)\n",
|
||||
" sigma = np.std(expectations[model], 1)\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user