This is for readers intersted in coding algorithms or who want to know how to do this accurately. This is what is done in ProMash (and perhaps other programs too).
To solve a problem like this you first need to know the extract potential for each grain. These are specified in the maltsters' data sheets and generally run 79 - 81% but those are typical lab numbers. The numbers you will realize are lower, how much lower depending on which point in the process you choose to define efficiency, your equipment, your procedures etc. If I divide the amount of extract that winds up in the fermenter by the weight of the grain I used I typically get about 65%. If I divide the weight of extract in the kettle by the weight of the grain it is more like 70%. Commercial operations get in the high 70's. Simply multiply each grain's weight by its extract potential to obtain the estimated extract for each grain. Thus 10 lbs of grain will yield 7 pounds of extract if your realized extract potential is 70%. Note that this is distinct from "efficiency" as referred to in the HB literature. Efficiency is usually taken to be the ratio of the realized extract potential to the maximum extract potential. Thus 70% realized extract potential would be called 87.5% (7/8) efficient if the particular malt had a lab rated extract potential of 80%. Home brewing books have tables of "points per pound per gallon" to be expected from a particular style of malt. There are problems with this way of looking at things ("points" are not linear with extract concentration but they are pretty close - close enough for homebrewing certainly) and what the book says may be different from the particular malt you are looking at but again, the differences will be small. Anyway, the first step is to calculate the extract. In the example of interest there were 8 + 1 + 0.5 = 9.5 pounds of grain. Assuming 70% extract potential (reasonable for the kettle) for each, just to make the math easier, these grains would yeild 6.65 pounds of extract.
In the next step we need to find out what concentration of extract in solution causes 4.5 gallons of wort to contain 6.65 pounds of extract. The amount of extract in a volume of wort is
x = P*(V*D*S)/100
here P is the concentration of extract by weight in percent i.e. how many grams of extract per 100 grams of wort. This is called the Plato strength (°P). The weight of the wort is its volume, V, measured at or corrected to room temperature times the density of water, D at room temperature (8.33 lbs/gal) times the specific gravity, S (Apparent, 20/20), of the wort. Solving for P*S
P*S = 100*x/(V*D) = 100*6.65/(8.33*4.5) = 17.74
Now all we need is the value of S which gives a value of 17.74. P is a function of S: P = -616.868 +1111.14*S -630.272*S*S +135.997*S*S*S. This is the ASBC polynomial which is the "official" relationship between Plato and SG in American brewing. Based on this P*S = -616.868*S +1111.14*S*S -630.272*S*S*S +135.997*S*S*S*S. If this is plotted over the range for which the ASBC polynomial applies and a fit done to S it is very nearly linear and an approximate value of S corresponding to a particular P*S can be found from
S = 1.0001 + 0.0038296*(P*S). Thus for P*S = 17.74 the corresponding value of S is 1.0680 SG. This approximation gives an answer accurate to about 1-2 digits in the 4th decimal place. For more exact solution one can use the second order fit (almost 2 orders of magnitude tighter) S = 0.0038626(P*S) - 0.000001526*(P*S)*(P*S) = 1.06804 which gives answers accurate to 2 digits in the 5th decimal place. Those who want an exact answer can use either of these formulae to get a close estimate which can be refined using Newton's method (the slope is m = -616.868 +2*1111.14*S -3*630.272*S*S +4*135.997*S*S*S). As the relationship is so nearly linear a single iteration suffices.
While this may look complicated once you have it set up in an Excel spreadsheet you don't have to worry about it any further. Just put in the extract and the volume and take out the specific gravity (and Plato if you want - stick the specific gravity you determine into the ASBC polynomial.

