The focal length of a modern zoom lens isn't something that is nice and easy to work with a lens equation to get the answer.
From hyperphysics on the true zoom telephoto lens, the lens can be thought of as a few different elements:
The problem is, these elements keep moving around:
which makes the entire system a bit more complex to calculate for. You might be able to sit down with the lens diagram for one lens, and work it out, but a general solution beyond the pure math isn't easy at all.
Pierre Toscani has a wonderful site (mostly in french, but there are many translated to English) that goes more into the specifics for specific Nikon lenses: http://www.pierretoscani.com/annexeGB.html
The diagram from hyper physics applied to the Nikon 80-200 f/2.8 as animated: http://www.pierretoscani.com/images/echo_telezooms_english/Figure-12.swf
Even different designs of the same lens introduce changes as seen with the 80-200 ff/2.8 to 70-200 VR f/2.8:
Specifically looking at the information about the pupil and aperture (and this is yet to be translated), figure 28 for a macro lens (animation - "N" is the f/stop).
I'm going to point out that all of the examples are with a constant aperture zoom. When you go to a variable aperture zoom, the design trade offs make to make it a simpler lens to produce (less glass) make the specifics of what the f/stop for any given focal length and focus distance is a non-trivial equation.
For example, for a Canon 70-300 f/4-5.6 from Outdoor Photography on Variable Aperture Lenses:
The fixed aperture zooms (70-200 f/2.8) have a fixed aperture in more ways than one. They both stay at the f/stop you selected, and the aperture actually is fixed in the location of the barrel of the lens. This isn't so with variable aperture zooms.
Note that in this chart, there is no rhyme or reason as to how an individual lens will change its f/stop in accordance with its focal length.
That the diaphragm moves as the zoom changes makes this non-trivial. Without close study of exactly how the lens is designed and what movements it has in its barrel, this is likely best done experimentally rather than mathematically.
Page three of Get The Most Out Of Variable Aperture Lenses describes this process in the section "Testing Variable Apertures". It boils down to:
- Dial in the widest aperture
- Slowly zoom from widest to longest
- As it switches from one f/stop to another, make note of that
- Plot it
The other approach is to set the camera to manual exposure (aperture, f/stop, and ISO) and then shoot a gray card. When you are done, reading the values back from the images should give you the information about the actual exposure the camera and lens system were providing from which you could determine the ratio of the aperture at any given focal length to the original aperture (wide open at widest).
That said, if you can hunt up the specific information for a lens, you may be able to find the information given for you. Lens designs can be patented. The Nikon 70-300 f/4.5-5.6 is covered under patent 7,158,315. And much of that information is boring... but as you dig through it, there is a table of lens specifications.
f= 71.40 135.00 294.00
FNO = 4.64 4.85 5.88
2ω = 34.46° 17.55° 8.20°
Going back to Pierre's site this is covered in his article Focal Length and Magnification
And while they don't give all the data for all the focal lengths, it puts you on the right path for the remaining calculations. Not all lens manufacturers give as detailed information in their patents though.