quad
One-dimensional adaptive quadrature.
y=quad(func,x1,x2)
(y, numeval)=quad(func,x1,x2, tol, x1Singularity,x2Singularity)
Inputs
func The function to be integrated.
x1 The lower limit of integration.
x2 The upper limit of integration.
tol The required accuracy of the solution.
x1Singularity A real number between 0 and 1 specifying the singularity of the function at x1 .
x2Singularity A real number between 0 and 1 specifying the singularity of the function at x2 .
Outputs
y The estimated integral.
numeval The number of function evaluations required to compute the integral.


Description
The optional input x1Singularity should be specified if the function behaves as (x-x1)^(-x1Singularity) at the lower limit of integration. The last optional input should be specified in a similar fashion. These parameters should be positive and less than 1 , as otherwise the integral does not exist.
Example
>>function func(p)
>   return @pfunc
>   function pfunc(x)
>       return x^p;
>   end
>end
>>for i=2:5
>        p=-1/i;	
>	if(i==2)
>           puts("  Singularity    Computed      Exact\n");
>	end
>	printf("%12.6f %12.6f %12.6f\n",p,quad(func(p),0,1,null,-p),1/(1+p))
>end
  Singularity    Computed      Exact
   -0.500000     2.000000     2.000000
   -0.333333     1.500000     1.500000
   -0.250000     1.333333     1.333333
   -0.200000     1.250000     1.250000