Cosmetic change. Redifinition of the nodes (removed the division by the square root of two) so that the routine is specialized for the integration of functions with gaussian weights.

time-shift
Stéphane Adjemian (Charybdis) 2012-11-29 11:53:32 +01:00
parent 5c0d387c4f
commit 74c856b727
1 changed files with 7 additions and 9 deletions

View File

@ -59,16 +59,15 @@ if nargin<3 || isempty(method)
end end
if strcmp(method,'Stroud') && isequal(n,3) if strcmp(method,'Stroud') && isequal(n,3)
%V = sqrt(pi)^d; r = sqrt(d);
r = sqrt(d/2);
nodes = r*[eye(d),-eye(d)]; nodes = r*[eye(d),-eye(d)];
weights = ones(2*d,1)/(2*d); weights = ones(2*d,1)/(2*d);
return return
end end
if strcmp(method,'Stroud') && isequal(n,5) if strcmp(method,'Stroud') && isequal(n,5)
r = sqrt((d+2)/2); r = sqrt((d+2));
s = sqrt((d+2)/4); s = sqrt((d+2)/2);
m = 2*d^2+1; m = 2*d^2+1;
A = 2/(n+2); A = 2/(n+2);
B = (4-d)/(2*(n+2)^2); B = (4-d)/(2*(n+2)^2);
@ -132,7 +131,6 @@ function m = ee(n,i,j)
%$ end %$ end
%$ %$
%$ % Check the results. %$ % Check the results.
%$ nodes = sqrt(2)*nodes;
%$ %$
%$ % Compute (approximated) first order moments. %$ % Compute (approximated) first order moments.
%$ m1 = nodes*weights; %$ m1 = nodes*weights;
@ -173,7 +171,7 @@ function m = ee(n,i,j)
%$ end %$ end
%$ %$
%$ % Check the results. %$ % Check the results.
%$ nodes = sqrt(2)*Omega*nodes; %$ nodes = Omega*nodes;
%$ %$
%$ % Compute (approximated) first order moments. %$ % Compute (approximated) first order moments.
%$ m1 = nodes*weights; %$ m1 = nodes*weights;
@ -214,7 +212,7 @@ function m = ee(n,i,j)
%$ end %$ end
%$ %$
%$ % Check the results. %$ % Check the results.
%$ nodes = sqrt(2)*Omega*nodes; %$ nodes = Omega*nodes;
%$ %$
%$ % Compute (approximated) first order moments. %$ % Compute (approximated) first order moments.
%$ m1 = nodes*weights; %$ m1 = nodes*weights;
@ -250,7 +248,7 @@ function m = ee(n,i,j)
%$ %$
%$ % Correct nodes for the covariance matrix %$ % Correct nodes for the covariance matrix
%$ for i=1:length(weights) %$ for i=1:length(weights)
%$ nodes(:,i) = sqrt(2)*Omega*nodes(:,i); %$ nodes(:,i) = Omega*nodes(:,i);
%$ end %$ end
%$ %$
%$ % Check the results. %$ % Check the results.
@ -288,7 +286,7 @@ function m = ee(n,i,j)
%$ end %$ end
%$ %$
%$ % Check the results. %$ % Check the results.
%$ nodes = sqrt(2)*nodes; %$ nodes = nodes;
%$ %$
%$ % Compute (approximated) first order moments. %$ % Compute (approximated) first order moments.
%$ m1 = nodes*weights; %$ m1 = nodes*weights;