The problem is that the function still returns non-unique coordinates, I think there is a mistake in the formula, but I\'m not sure, maybe the error is something else.