all these power calculations (here and in _get_coefficients()) could be pre-calculated iteratively once and then stored in an array and indexed in all the for loops/equations.  Then you only have to do 6 multiplications per function call.