-*-pa-*- ps2 done, created function, return argmin