function QMCManifold(s,t,j,N)
% Demonstration 
% s - Test function choosen, from 1 to 4
% t - Manifold where you decide to integrate
%     t=1 CONE     t=2  CYLINDER     t=3 TORUS   t=4 SPHERE
% j - Type of pointset   j=1 Halton points,
%     j=2 Fibonacci points, j=3 Greedy minimal k_2 energy points
% N - Number of points or the N-th number of Fibonacci for the Fibonacci
%     points


format long
%Compute the exact value of the integral of the function #s on 
% t=1 Cone
% t=2 Cylinder
% t=3 Torus
% t=4 Sphere
s1='Computing the integral of the function #';
if t==1
    s2=' on the cone.\n';
elseif t==2
    s2=' on the cylinder.\n';
elseif t==3
    s2=' on the torus.\n';
elseif t==4
    s2=' on the sphere.\n';
end
ss=strcat(s1,num2str(s),s2);
sprintf(ss)
FF=fun(s,t);

% j - Type of points
% 1 - Halton
% 2 - Fibonacci
% 3 - Greedy minimal k_2 energy
fprintf('Generating the point set\n');
X=pointset(N,j,t);
ff=f(s);
F=feval(ff,X(:,1),X(:,2),X(:,3));
if(j==2)
    N=fibonacci(N);
end
FF1=sum(F)/N;

fprintf('Computing the integral of the function ');
ff
switch t
    case 1
        stringa=' on the cone.\n';
    case 2
        stringa=' on the cylinder.\n';
    case 3
        stringa=' on the torus.\n';
    case 4
        stringa=' on the sphere.\n';
end
sprintf(stringa)
fprintf('We have the following relative error');
ErrR=abs((FF-FF1)/FF)
PtPlot(t,X);


end