# Philippe's simple example #-------------------------- # 1 <= i <= P # 1 <= j <= P # 1 <= k <= P # i+j+k-2 = Q #-------------------------- 7 7 # i j k P Q 1 1 1 0 0 0 0 -1 1 -1 0 0 1 0 0 1 0 1 0 0 0 -1 1 0 -1 0 1 0 0 1 0 0 1 0 0 -1 1 0 0 -1 1 0 0 0 -1 -1 -1 0 1 2 #-------------------------- # Context: 2 parameters, no constraints on them. 0 4 #-------------------------- # I have done the work by hand, and here is the answer : # # If 1 <= Q <= P then EQ(P,Q) = 1/2 Q^2 + 1/2 Q # If P <= Q <= 2P-1 then EQ(P,Q) = -3/2 P^2 - Q^2 + 3PQ - Q # If 2P-1 <= Q <= 3P-2 then EQ(P,Q) = 9/2 P^2 + 1/2 Q^2 - 3PQ - 3/2 P + 1/2 Q