Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If all 16 values are expected, then you can do also:

def F(x):
       a=x[0];v=x[1] 
       if v > a :
            return 4*a - 3*(v-a)
       else : 
            return v - 2*(a-v)^2

L0=range(4)
L3=cartesian_product([L0,L0]);
list(zip(L3,map(F,L3)))

If all 16 values are expected, then you can do also:

def F(x):
       a=x[0];v=x[1] v=x[0];a=x[1] 
       if v > a :
            return 4*a - 3*(v-a)
       else : 
            return v - 2*(a-v)^2

L0=range(4)
L3=cartesian_product([L0,L0]);
list(zip(L3,map(F,L3)))