This is an odd way to write it.  Why not just `g1 = -g np.cos(2*phi)`?  

Also a computational trick is available to avoid trig:
```
dx = pos_x - self.halo_pos.x
dy = pos_y - self.helo_pos.y
drsq = dx*dx+dy*dy
cos2phi = (dx*dx - dy_dy)/drsq
sin2phi = (2.*dx*dy)/drsq
g1 = -g*cos2phi
g2 = -g*sin2phi
```