% Coherent state (Sec. II.C) % |alpha> = exp(-|alpha|^2/2) * sum_n alpha^n/sqrt(n!) |n> % The infinite sum is truncated at d-1; check that the norm stays ~1. clear; % Clear memory clc; % Clear the command window/screen d = 10; % dimension of the field I = eye(d); alpha = 0.6; % amplitude of the coherent state Coh = 0; % initialization for x = 0:d-1 Coh = Coh + exp(-norm(alpha)^2/2)*alpha^x/sqrt(prod(1:x))*I(:,x+1); end Coh % display the coherent state N_c = norm(Coh) % check norm (should be very close to 1)