translate some math from python