Edit: Warning, I am pretty sure the following is not correct.
Edit2: It is definitely incorrect. See Post 11
Hi,
I am quite new to the game and started to wonder at which point I should stop building new cities. As building a new city increases unrest there is a point where this extra unrest will be more harmful than the relative benefits of a new city.
I should stop building new cities when I reach this point. So I tried to develop a formula to describe this with x being the amount of cities.

On the left part is the extra unrest per city, on the right part the relative benefit of a new city. Example: if you have 4 cities and build a fifth, the relative benefit is

If I solve the first formula x is about 5.77. That means I should not build more than 6 cities.
Of course for this simple example I am ignoring any improvements that reduce unrest, traits and heroes and the secondary effects of new cities (roads, new resources). On the other hand a new city is not as productive as an older city (so the right part is too optimistic, too) and the cost of a settler is also ignored. My guess is that this more or less evens out.
Am I wrong? Do you have any comments or advice?