% Squeezed vacuum state (Sec. II.E) % |xi> = 1/sqrt(cosh r) * sum_n (-1)^n sqrt((2n)!)/(2^n n!) e^{i n theta} (tanh r)^n |2n> % A superposition of the even number states only. clear; % Clear memory clc; % Clear the command window/screen d = 20; I = eye(d); r = 0.3; % squeezing parameter theta = pi/4; % squeezing direction Sqz = 0; % initialization for x = 0:(d/2)-1 p = (1/sqrt(cosh(r)))*sqrt(prod(1:(2*x)))/(2^x*prod(1:x)); Sqz = Sqz + p*(-1)^x*exp(i*x*theta)*(tanh(r))^x*I(:,2*x+1); end Sqz % squeezed vacuum state output N_sqz = norm(Sqz) % check norm (should be 1)