Raith, that's very nicely done... and pretty much spot on for how it works in my experience too.
Lots of sciency stuff goes in there and whatnot... and what you get for ranges are like that. As you increase weight, effective range goes up, usually accompanied by a decrease in maximum range (which would have to be an average, as reliability goes out the door at the extreme end of your absolute maximum range anyways).
Technically, there's a weight of BB that gives (each individual gun) the absolute maximum range, and one weight that should give the best effective range at every air/weather/temperature condition, and the functions aren't linear (like when you get the BB waaaay too heavy or waaaaay too light, you either can't shoot more than a couple feet or can't hit anything past a couple feet. There's a happy medium that is gun-specific.