added some math algorithms