# Bosonic backend, defining cat state in multiple modes

Hello,
I was wondering if it was possible to define a cat state in multiple modes? This would be in the bosinic background, like the example given for 1 mode here : An introduction to the bosonic backend — Strawberry Fields

In the example of 2 modes, in the density matrix formalism (let us use qutip), one can define a cat state in mode 1 by alpha1, and mode 2 by alpha2. And then taking the tensor product of the 2 modes.

In principle this has a 4d wigner equivalent. Taking the partial trace one can plot Wigner function to see the cat in each mode (this would be equivalent to integrating over the two other directions in the 4d wigner function if I am correct).

Anyway. Is it possible to define a cat state in 4d? i.e. 2 modes using your complex Gaussian description? Thank you very much,

Hi @TheyAreComing , welcome to the forum!

My colleague Luke helped me find an answer.

If they’re two independent cat states you could do something like the following:

``````import strawberryfields as sf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import cm

# Simulation and cat state parameters
nmodes = 2
cutoff = 30
q = 4.0
p = 0.0
hbar = 2
alpha1 = (q + 1j * p) / np.sqrt(2 * hbar)
alpha2 = (q + 1j * p) / np.sqrt(2 * hbar)
k = 1

prog_cat_fock = sf.Program(2)
with prog_cat_fock.context as q:
sf.ops.Catstate(a=np.absolute(alpha1), phi=np.angle(alpha1), p=k) | q[0]
sf.ops.Catstate(a=np.absolute(alpha2), phi=np.angle(alpha2), p=k) | q[1]

eng = sf.Engine("fock", backend_options={"cutoff_dim": cutoff, "hbar": hbar})
state = eng.run(prog_cat_fock).state

# We now plot it
xvec = np.linspace(-15, 15, 401)
W = state.wigner(mode=0, xvec=xvec, pvec=xvec)
Wp = np.round(W.real, 4)
scale = np.max(Wp.real)
nrm = mpl.colors.Normalize(-scale, scale)
plt.axes().set_aspect("equal")
plt.contourf(xvec, xvec, Wp, 60, cmap=cm.RdBu, norm=nrm)
plt.show()
``````

You could see one mode with `W = state.wigner(mode=0, xvec=xvec, pvec=xvec)` and the other with `W = state.wigner(mode=1, xvec=xvec, pvec=xvec)`

I hope this helps!