
%  The script file table1.m computes the spectrum of
%  the quadratic oscillator p(x) = x^2.  It is listed
%  in Table 1 of the paper
%  JAC Weideman, "Spectral Differentiation Matrices for the Numerical
%  Solution of Schroedinger's equation" (submitted).

N = 5; c = 1;               % Increase N for bigger matrices
[x, D] = herdif(N, 2, c);   % Assemble Hermite DMs
D2 = D(:,:,2);              % Extract the second derivative
A  = -D2+diag(x.^2);        % Assemble the matrix A
E  = sort(eig(A))           % Compute and sort the e-values