21c62a3Quantum optics in numbl: companion to arXiv:2309.14354Jeremy Magland 1% Coherent state (Sec. II.C)
2% |alpha> = exp(-|alpha|^2/2) * sum_n alpha^n/sqrt(n!) |n>
3% The infinite sum is truncated at d-1; check that the norm stays ~1.
5clear; % Clear memory
6clc; % Clear the command window/screen
7d = 10; % dimension of the field
8I = eye(d);
9alpha = 0.6; % amplitude of the coherent state
10Coh = 0; % initialization
11for x = 0:d-1
12 Coh = Coh + exp(-norm(alpha)^2/2)*alpha^x/sqrt(prod(1:x))*I(:,x+1);
13end
14Coh % display the coherent state
15N_c = norm(Coh) % check norm (should be very close to 1)