% Annihilation, creation and number operators (Sec. III.A) % a|n> = sqrt(n)|n-1>, a'|n> = sqrt(n+1)|n+1>, N = a'a, N|n> = n|n> % The creation operator is the adjoint of the annihilation operator. clear; % Clear memory clc; % Clear the command window/screen d = 6; % dimension of the operator A = diag(sqrt(1:d-1), 1) % Annihilation operator (superdiagonal) Ad = A' % Creation operator (adjoint of A) N = Ad*A % Number operator (diagonal: 0,1,2,...)