% script.m
nn = 8;
n = 10;
ratios = zeros(nn,3);
for ii = 1:nn
  ratios(ii,1) = n;
  t = linspace(0,1,n)';
  ptrue = 6*t-t.^4/6-35/6;
  ytrue = t.^3/3;
  gradtrue = ptrue.*ytrue;
  u = zeros(n,1);
  ratios(ii,2) = norm(finqu5grad(u)-gradtrue,inf);
  ftrue = 1/63-1/2+9;
  ratios(ii,3) = abs(finqu5(u)-ftrue);
  n = 2*n;
end 
ratios(2:nn,2:3)=ratios(2:nn,2:3)./ratios(1:nn-1,2:3);