added functions for derivatives and inner products