The following lines are all too long. Consider using a pep8 checker. Since there are only three terms and two expensive operations (cos, sin) done on them, I would save some flops by doing `cos_y = cos(y)`, `sin_y = sin(y)`, etc., while you're digging around in there.