| 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)))
| 2 | No.2 Revision |
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)))
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.