I have just started studying QM and I got into some trouble understanding something:
Let's say there is a wave function of a particle in a 1D box ($0\leq x\leq a$):
$$\psi(x,t=0) = \frac{i}{\sqrt{5}} \sin\left(\frac{2\pi}{a}x\right) + \frac{2}{\sqrt{5}} \sin\left(\frac{5\pi}{a}x\right)$$
Then if we measure the energy, the probability of getting the energy associated with $ \sin(\frac{2\pi}{a}x) $ is $\left| \frac{i}{\sqrt{5}} \right|^2 = \frac{1}{5}$ and the probability of measuring the energy associated with $\sin\left(\frac{5\pi}{a}x\right)$ is $\left| \frac{2}{\sqrt{5}}\right|^2 = \frac{4}{5}$. So the magnitude of $ \frac{i}{\sqrt{5}} , \frac{2}{\sqrt{5}} $ determines the probability, but what is the meaning of the phase? To me, as someone who measures energy, I'll get the same thing if
$$\psi(x,t=0) = \frac{-1}{\sqrt{5}} \sin\left(\frac{2\pi}{a}x\right) + \frac{2}{\sqrt{5}} \sin\left(\frac{5\pi}{a}x\right) $$
So why does the phase matter? If it matters, how do I know to which phase the wave function collapsed after the measurement?