Yair said:
			
		
	
	
		
		
			That's an interesting formula, I too would love an explanation of how you came about to it. Is this based on historical comparisons? NPC levels? What?
		
		
	 
Oddly enough, it came about because I was working on figuring out how to determine salary demands for fictional basketball players in a sim league I was working in... I discovered that using (log n)/(log 4) keeps things from "blowing up" too quickly (to borrow a term I got from my math teachers in college).  The problem is that the "by the book" method tends to scale community wealth geometrically (because population affects the formula for determining wealth twice - once in the population itself, and then again in increasing the GP limit) - this is of course problematic when you're dealing with a village of 20 versus a city of 20,000 - the average city dweller isn't 1,000 times as rich as the commoner, he's a million times as rich thanks to geometric scaling... and of course that kind of disparity looks somewhat ridiculous!
It's not based off anything "historical" but instead based on much trial and error on trying to get a function that gives you a "reasonably smooth curve" of results across numbers that are several orders of magnitude apart.  (In other words, it looked somewhat realistic).  I could have said log4(P), which is how I noted it for myself, but not many calculators have the ability to take logs in base 4. 

  You want average wealth to go up as a community gets larger - tasks can be more specialized, economies of scale come into play, etc., but you don't want it to be geometric progression.
The 0.161 is just a normalization constant - since the smallest "community" that actually counts as such is 20 people, I used it to "saw off" the nastiness in log(20)/log(4) - which is 2.161 - to make a community of 20 people have 40 gp to spend instead of 43.22.  A purely aesthetic choice, and you could do away with it entirely without having too much of an effect on the end result.
	
	
		
		
			Where do you get the number for C (cash on hand)? What is "log"?
		
		
	 
Cash on hand is C as determined by the first formula I showed, and is simply a function of P, which is defined as population (hopefully, you know the population of the city).  
(math teacher hat on)
Log, as was already explained, is a mathematical function.  It's the reverse of "10 raised to the power of" - in other words, it's the answer to the question "ten to the power of what equals this number" where you know "this number" and you're looking for the "what" - thus, log of 10 is 1 (ten to the first power is 10), log of 100 is 2 (ten to the second power is 100), log of 1000 is 3 and so on.  You usually use a calculator to pick off the log; almost every calculator that is more than an "add subtract multiply divide only" calculator will have a log button.
Similarly, what log P/log 4 really means is "4 raised to the power of what is equal to P" but since most calculators don't let you choose the number you're raising when you hit the log key, and instead assume it's 10 - you have to use the mathematical substitution of dividing one log by another.  As was mentioned earlier, you'll also find a "ln" key on your calculator; that is "e to the power of what is equal to this number" and e is roughly equal to 2.7182818 (when you hit second-year calculus/statistics, you'll likely learn a lot about e, and why it is what it is; first year calculus students will simply know that e^x integrates and has derivatives of itself taken nicely).  If you really wanted to, you could use ln P/ln 4 instead of log P/log 4; the answers would be the same, but that's taking us off on a math tangent.
(math teacher hat off)
At any rate, this function makes the "gold on hand per capita" (as a parenthetical note, this amount is simply log P/log 4 - 0.161) increase as population increases, but at a much slower rate than the DMG formula.  For instance, the "total cash on hand" for a city of 30,000 (the same number used in the 7.5 billion chickens example) is 218,260 gp.  The total value of any item available (including chickens) is one tenth of that, or 21,826 gp.  For instance, that's 14 suits of full plate - not terribly unreasonable to assume that about a dozen citizens in a large city own a suit of full plate (the local lord, his son, the captain of the guard, a couple of rich merchants who have them as collector's pieces, and half a dozen others).  At 2 cp per chicken, that's (roughly) 1.1 million chickens - still probably too many, but it's not completely ridiculous - that's only enough chickens for each citizen to have one per day for 36 days before exhausting the supply of chickens (while chickens are only one form of food, you get the idea - a yearlong siege now becomes disastrous for the food supply, since the chickens are gone in a year even if you only eat one every 10 days!)... and it's certainly better than 7.5 billion chickens (enough to feed each citizen one chicken per day for almost 700 years - making a 50-year siege laughable)!
I don't know how much more in-depth you'd like me to go, it's pretty simple from there.  In the above example of 30,000 people, the average "cash on hand per capita" is: 218,260 gp (total cash on hand) divided by 30,000 (the number of people).  This means on average, you can expect any given citizen to have 7 gp in coins and "liquid assets" to purchase stuff (this is not the total value of his possessions; this is the amount of cash he has available separate from his possessions).  Of course, some will have less, and some will have more.  With a "single item limit" of 21,826, if you're looking for a longsword (15 gp), you can expect to find 21,826/15 or about 1450 longswords in the community... one for about every 20 citizens (possibly a bit high).  If you're looking for a +1 longsword (2315 gp), you'll find 9 of them in the city (21,826/2315 = 9).  Looking for a +2 longsword (8315 gp)?  There are two.  Looking for a +5 longsword (50,315 gp)?  That's over the threshold, so there's no guarantee you'll find one - there is a (21,826/50,315 = 0.43) 43% chance that one even exists in the community at all - and even if it does, it's probably NOT for sale (perhaps owned by the captain of the guard or an ex-adventurer).
In a town of, say, 4,500 people, the average "cash on hand" total is 26,199 (we'll call it 26,200 for simplicity).  That makes average "cash on hand" per capita 5.8 gp.  The "single item limit" is just 2,620 gp.  That means you'll find one, maybe two suits of full plate (1,500 gp) in the entire town.  You'll find about 175 swords, and probably only one +1 longsword (and again, it's not likely to be for sale).  A +5 longsword?  There's only a 5% chance one exists anywhere in this mid-size town (2,620/50,315 = 0.05).  What's that?  Chickens?  The town has about 131,000 chickens - that's about 29 chickens per person (enough for everyone to eat one chicken per day for a month).
A hamlet of 525 people has a total cash on hand of 2288 gp.  The average person has about 4 gp in cash.  Your "single item limit" is 288 gp - meaning that there's only about a one in five chance of finding a suit of full plate.  You'll find about 19 longswords.  A +1 longsword?  Only a 12% chance of one existing in the hamlet.  A +5 longsword?!? If the GM feels generous, a 1% chance (288/50,315 = 0.0057 or half a percent).  Chickens?  About 14,400 chickens - 27 per person.
If you want more examples, let me know.
--The Sigil