  function P3()
% Tests Sylvester
% Generate a random nxn example with k positive eigenvalues...
n = 10;
k = 4;
d = [rand(k,1);-rand(n-k,1)];
[Q,R] = qr(randn(n,n));
A = Q*diag(d)*Q';
% Apply Sylvester and display...
[nNeg,nPos] = Sylvester(A);
clc
fprintf('The eigenvalues:\n')
fprintf('    %20.15f\n',d)
fprintf('\nnPos = %1d\nnNeg = %1d\n\n',nPos,nNeg)


