I'm trying to simulate a quantum gate operation in mathematica using a harmonic oscillator and I have some confusion with how the physical system relates to the theory. This may be a bit long winded but I hope the question is clear.
The solution to the Schrodinger equation for the Harmonic Oscillator is given by: $$ \langle x|\phi_k\rangle := \frac{1}{\sqrt{2^k k! \sqrt{\pi}\ }} .e^{-x^2/2} . \operatorname{HermiteH}[k,x] $$ where the $\text{HermiteH}[k,x]$ denotes the built in Mathematica function for finding the Hermite Polynomial at energy level $k$ and position $x$. (the fact I'm using mathematica is irrelevant to the question)
These energy levels can used as a physical representation of the qubits (In reality, it is not sufficient to use just one harmonic oscillator but it serves the purpose to demonstrate the technique). The Hamiltonian for the oscillator is first defined as $ \textit{H} = \hbar \omega a^{\dagger} a $. Using the Hamiltonian operator, we can then define the unitary time evolution operator $U(t) = e^{i\textit{H}t/\hbar}$ which determines the evolution of the system over time.
I have picked an example from Nielsen and Chuang's book on using a single harmonic oscillator to implement a CNOT gate.
By choosing an appropriate time interval, this operator can have the desired effect we require in order to implement a CNOT gate (or any other quantum gate) operation. Now we must choose an appropriate representation for the qubits so that the time evolution operator will simulate the appropriate quantum gate. In the case of a CNOT gate, we would like our unitary operator to transform the qubit pairs in the following way: $$ |00\rangle \rightarrow |00\rangle $$ $$ |01\rangle \rightarrow |01\rangle $$ $$ |10\rangle \rightarrow |11\rangle $$ $$ |11\rangle \rightarrow |10\rangle \, . $$ These two qubits are then encoded by mapping them onto the following harmonic oscillator states: $$ |00 \rangle = |\phi_0 \rangle $$ $$ |01 \rangle = |\phi_2 \rangle $$ $$ |10 \rangle = \frac{ 1}{\sqrt{2}} (|\phi_4\rangle + |\phi_1\rangle) $$ $$ |11 \rangle = \frac{ 1}{\sqrt{2}} (|\phi_4\rangle - |\phi_1\rangle) \, .$$ At the start time $t=0$, the system will be in a state spanned by these basis states and then if we evolve the system forward to an appropriate time, in this case $t = \frac{\pi}{\omega}$, then the energy eigenstates of the oscillator will undergo the transformation: $$ |\phi_k\rangle \rightarrow e^{-i \pi a^{\dagger} a} |\phi_k\rangle = (-1)^k |\phi_k\rangle \, .$$ This means that even values of $k$ will remain unchanged whereas odd values will pick up a minus sign $(|\phi_1\rangle \rightarrow -|\phi_1\rangle)$ and thus we obtain the required transformation.
So finally here is the question:
If the qubits are represented by different energy levels of the harmonic oscillator, then where does the position come into play? ( as in what can be used as an $x$ value in the equation). The book just says that we map the qubits to the energy levels but I assume that the position needs to be defined.