Required to prove: $\mathbb{E}[{\Vert\frac{1}{\sqrt{k}}Ax\Vert}^2] = \mathbb{E}[\Vert x \Vert^2]$ where $A$ is a Gaussian matrix with $k \times d$ dimensions and $x$ is a vector $\in \mathbb{R}^d$.
This is my python code: https://gist.github.com/mihir478/074a8987e7268eab6ebcdb08195ad71a
Reference for the equation: https://ttic.uchicago.edu/~gregory/courses/LargeScaleLearning/lectures/jl.pdf
I would really appreciate if someone can find my mistake in computing the length of the estimate that uses phi.
You erroneously normalized $x$ to be unit length in line (22) (which is why groundtruthvalue always returns 1) and took the squareroot in (26) when you shouldn't have.