% Script to test composite quadrature rules
% K. Ming Leung, 02/09/03

clear all; format long e;
fcn = 'oneOverX'; 
a = 1; b = 2; n = 8; 
Iexact = log(2),

Imidpoint = midpoint(fcn,a,b,n);
errorMid = Imidpoint-Iexact,

Itrapezoid = trapezoid(fcn,a,b,n);
errorTrap = Itrapezoid-Iexact,

ISimpson = Simpson(fcn,a,b,n);
errorSimp = ISimpson-Iexact,

% Uncomment the following 3 line to test the Romberg quadrature
%IRomberg = Romberg(fcn,a,b,2);
%errorRomb = IRomberg(end,end)-Iexact,
%IRomberg = Romberg('sin',0,pi,6),
