This entire issue is complicated by the factor of real-world conditions of lens quality variability. There's no simple formula. There are merely trends with many exceptions.
I did some test shoots a while back with my Canon 100-400 IS zoom at 400mm, at various f stops, with 1.4x extender, with both 20D and 5D. I was trying to find out how the 20D compared with the 5D for ultimate telephoto reach, and how diffraction effects might vary with both cameras as one stopped down.
I won't repeat the images I posted a year or so ago, of rural scenes. The following images, not posted before, include line charts, and printed text which in some respects is a better guide to resolution than line charts. If you can read it, then that's better than not (or hardly) being able to read it.
First, below is the 20D at f22 compared with the 5D at f22, with 560mm lens. Both images were converted in ACR with default settings (including sharpening at a default 25). The 5D image was interpolated with bicubic sharper, so both images are the same pixel density (on screen). Of course, the 5D image has a greater FoV, but the purpose of the test was to determine the best maximum telephoto reach and at what aperture.
[attachment=1668:attachment]
As you should be able to see, even at f22 the 20D is streets ahead of the 5D, in this respect (okay, maybe just half a street ahead). Call the lens a coke bottle if you like, but that doesn't change the results. We would merely amend our description to include 'coke bottle', along the lines, Even using a coke bottle, the higher-pixel-density 20D delivers more detail at f22 than the 5D. Okay!
Next, a comparison of text from f8 to f45, with the 5D and 560mm lens.
[attachment=1669:attachment]
What is surprising here is that f32 seems better than f8. If you want to criticise me for not being 'spot on' with my focussing, then repeat the experiment yourself.
Next, a comparison of text from f8 to f45 with the 20D.
[attachment=1670:attachment]
Here we have a situation where f8 is marginally better than f32, but not by much. F22 is still better than f8.
For those who are interested, I'll post a few more comparisons below, which are really self-explanatory because I've labelled each image clearly, something I wish other posters would do when they post their comparison test shots.
[attachment=1671:attachment] [attachment=1672:attachment] [attachment=1673:attachment]
[attachment=1675:attachment]