ps: Generic function for computing derivatives of basis