function demo_disk

ade=30; % Define "n", "m" (cardinality of the rules).

example=1; % define example
switch example
    case 1
        f=@(x,y) (x+0.5*y).^10; % integrand
        Iex=3.932323797070195e-01 ; % numerically exact integral
    otherwise
        f=@(x,y) (1+x+0.5*y).^11; % integrand
        Iex=5.546261116442703e+02 ; % numerically exact integral
end

% External routine that computes nodes and weights.
[nodes,weights]=define_rule_disk(ade);

% Compute integral.
fnodes=feval(f,nodes(:,1),nodes(:,2));
Inum=weights'*feval(f,nodes(:,1),nodes(:,2));

% Statistics
fprintf('\n \t * # : %-8.0f',length(weights));
fprintf('\n \t * #T: %-8.0f',ceil((ade+1)/2)*(ade+1));
fprintf('\n \t * I : %-1.15e',Inum);
fprintf('\n \t * AE: %-1.3e',abs(Inum-Iex));
fprintf('\n \t * RE: %-1.3e \n',abs(Inum-Iex)/abs(Iex));

% Plot disk and pointset
th=linspace(0,2*pi,100); gray_color=[211, 211, 211]/256;
fill(cos(th),sin(th),gray_color); hold on;
plot(nodes(:,1),nodes(:,2),'go','MarkerEdgeColor','k',...
    'MarkerFaceColor','g','MarkerSize',6);
axis equal; axis tight;
hold off;