def dfdr(r,theta): out = (2*K*np.pi*np.sin(2*np.pi*K/r) -r*np.cos(2*np.pi*K/r))*np.sin(theta)/(r**3) out[-1] = 0 return out