add math functions for ndarrays