function [maximum,err]=quad2(pts,checkpt,location)
%QUAD2	Quadraticly interpolates three points to find the maximum value.
%	QUAD2(PTS,CHECKPT,LOCATION)
%	The second argument, CHECKPT, is for estimation of the error 
%	in the interpolated maximum. 
c=pts(1);
ab=[-1 0.5; 2 -0.5]*(pts(2:3)-c*ones(2,1));
stepmin=-ab(2)/(2*ab(1));
maximum=ab(1)*stepmin^2+ab(2)*stepmin+c;
if nargin>1
	if location==0
		checkpt2=-abc(1)+abc(2)-abc(3)+d;
	else
		checkpt2=64*abc(1)+16*abc(2)+4*abc(3)+d;
	end
	err=checkpt-checkpt2;
end
