Added unitary test.

time-shift
Stéphane Adjemian (Charybdis) 2011-12-16 15:14:59 +01:00
parent cd9250edbf
commit 6cecc181dc
1 changed files with 16 additions and 1 deletions

View File

@ -56,4 +56,19 @@ JacobiMatrix = diag(b,1)+diag(b,-1);
JacobiEigenVector = JacobiEigenVectors(1,:);
JacobiEigenVector = transpose(JacobiEigenVector(idx));
weights = JacobiEigenVector.^2;
nodes = sqrt(2)*nodes;
nodes = sqrt(2)*nodes;
%@test:1
%$ n = 5;
%$ [nodes,weights] = gauss_hermite_weights_and_nodes(n);
%$
%$ sum_of_weights = sum(weights);
%$
%$ % Expected nodes (taken from Judd (1998, table 7.4).
%$ enodes = [-2.020182870; -0.9585724646; 0; 0.9585724646; 2.020182870];
%$
%$ % Check the results.
%$ t(1) = dyn_assert(1.0,sum_of_weights,1e-12);
%$ t(2) = dyn_assert(enodes,nodes/sqrt(2),1e-8);
%$ T = all(t);
%@eof:1