Looks like `N = 1` and `w_i = 1`  will give 0/0, so that may need to be handled.