Currently I am simulating a quantum gate using verilog. I learned that: $$ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle $$
I want to ask: when simulating, should I let alpha and beta be complex numbers or real numbers?
Currently I am simulating a quantum gate using verilog. I learned that: $$ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle $$
I want to ask: when simulating, should I let alpha and beta be complex numbers or real numbers?
A general single-qubit quantum state is described, as you mentioned, as $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$. Numbers $\alpha$ and $\beta$ are called probability amplitudes and they are in general complex. Since square of their absolute values, i.e. $|\alpha|^2$ and $|\beta|^2$, are probabilities of measuring $|0\rangle$ and $|1\rangle$, respectively, it must hold that $|\alpha|^2 + |\beta|^2 = 1$ (so-called normalization condition).
What is more, as $\alpha,\beta \in \mathbb{C}$, they can be expressed as $|\alpha|\mathrm{e}^{i\varphi_\alpha}$, similarly for $\beta$. This leads to description of state $|\psi\rangle$ as $$ |\psi \rangle = |\alpha|\mathrm{e}^{i\varphi_\alpha}|0\rangle + |\beta|\mathrm{e}^{i\varphi_\beta}|1\rangle. $$
Factoring out $\mathrm{e}^{i\varphi_\alpha}$ we get
$$ |\psi \rangle = \mathrm{e}^{i\varphi_\alpha}(|\alpha||0\rangle + |\beta|\mathrm{e}^{i(\varphi_\beta-\varphi_\alpha)}|1\rangle). $$
Term $\mathrm{e}^{i\varphi_\alpha}$ (or rather $\varphi_\alpha$ to be precise) is called global phase and can be neglected as two quantum states which differing by the global phase are indistinguishable. Term $\mathrm{e}^{i(\varphi_\beta-\varphi_\alpha)}=\mathrm{e}^{i\varphi}$ (or rather $\varphi$) is called relative phase (see more on phases here). So, neglecting the global phase we are left with $$ |\psi \rangle = |\alpha||0\rangle + |\beta|\mathrm{e}^{i\varphi}|1\rangle. $$ Now, we can use the condition $|\alpha|^2 + |\beta|^2 = 1$ and goniometric identity $\sin^2(x) + \cos^2(x) = 1$ to express the single-qubit state as $$ |\psi \rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)\mathrm{e}^{i\varphi}|1\rangle, $$ where $0 \le \theta \le \pi$ and $0 \le \varphi\le 2\pi$.
Because of normalization condition and neglecting global phase, we removed two degrees of freedom. In the end, the general single-qubit state can be desribed with two real numbers and graphicaly represented on a sphere (similarly to geographical coordinates). This sphere is called Bloch spehere, see more here.
Just note (intuition) why angle $\theta$ is halved in the expression above. For $\theta = 0$ we get north pole of the sphere and $|\psi\rangle = |0\rangle$. Similarly for $\theta = \pi$ we have $|\psi\rangle = |1\rangle$, i.e. the south pole (but although $\theta = \pi$, we need only half to eliminate $|0\rangle$ and have only $|1\rangle$). An equator of the sphere represents states $|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + \mathrm{e}^{i\varphi}|1\rangle)$. Those states have equal probability of collapsing into either $|0\rangle$ and $|1\rangle$. So we have to have $\sin(x)=\cos(x)$, which occurs for argument $\pi/4$. However, on a sphere, $\theta$-coordinate of the equator is $\pi/2$. So, $\theta$ has to be halved.
So, it depends on tools you have at your disposal for describing the quantum state. You can use two complex numbers (but taking account the normalization condition and global phase) or two real angles.