
function demo_simplex

ade=10;
        
f=@(x,y) (0.3*x+0.9*y).^10;
I=6.254277723408297e-02;
        

% Gaussian rule with degree ADE.
[nodes,weights]=define_rule_simplex(ade);
fP=feval(f,nodes(:,1),nodes(:,2));  

Inum=weights'*fP;

% Stats
fprintf('\n \t * ade: %-8.0f',ade)
fprintf('\n \t * #  : %-8.0f',length(weights))
fprintf('\n \t * I  : %-1.15e',Inum)
fprintf('\n \t * AE : %-1.3e',abs(I-Inum))
fprintf('\n \t * RE : %-1.3e \n',abs(I-Inum)/abs(Inum))

gray_color=[211, 211, 211]/256;
fill([0 1 1 0],[0 0 1 0],gray_color);
hold on;
plot(nodes(:,1),nodes(:,2),'go','MarkerEdgeColor','k',...
    'MarkerFaceColor','g','MarkerSize',6);
axis equal; axis tight;
hold off;
