function A = q_matrix ( n )

%*****************************************************************************80
%
%% q_matrix() returns the Q matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 July 2022
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Cleve Moler,
%    An interesting, and perhaps new, matrix,
%    https://blogs.mathworks.com/cleve/,
%    20 July 2022.
%
%    Graeme Fairweather,
%    On the eigenvalues and eigenvectors of a class of Hessenberg matrices,
%    SIAM Review,
%    Volume 13, Number 2, 1971, pages 220-221.
%
%  Input:
%
%    integer N, specifies the order of the matrix.
%
%  Output:
%
%    real A(2*N+1,2*N+1), the matrix.
%
  A = (-n:n).^2 + (-n:n)'.^2;

  return
end
