// primitive at middle points
sum = 0.0;
for (int i=0; i<N-1; i++) {
final double p = (x.get(i) + x.get(i+1))/2;
sum += (x.get(i+1) - x.get(i)) * y.get(i+1)/2;
final double calculated = f.primitive(p);
final double expected = sum;
sum += (x.get(i+1)-x.get(i))*y.get(i+1)/2;
assertFalse("failed to reproduce expected datum"
+"\n expected value: "+expected
+"\n calculated value: "+calculated