Rg of Sphere (GRID search) data angle 30 35 40 45 50 55 60 65 70 75 90 105 110 115 120 125 130 135 G reading 210.2 147.7 103 73.3 42.6 25 13.7 5.7 1.9 0.9 2.9 5.3 5.2 4.8 5 5 5 5.2 The data above represent light scattering galvanometer measurements for a suspension of large latex spheres. Solvent intensity in this case is almost zero at any angle. Intensities are not corrected for scattering angle (i.e., volume); you have to apply the sin() correction yourself. You probably already saw these data in a problem that asked you to use Excel Solver (or similar) to find the size. You essentially searched for I(0) and R values to fit the equation below to the data. 2 3 I (q) I (0) 3 (sin x x cos x) x where x = qR (not Rg) and I(0) is the intensity at zero scattering angle. A problem with Solver (and other nonlinear fitting algorithms) is that it can get “stuck” at a solution that is not really the best one, but just the best answer close to your initial starting guesses. For this reason, nonlinear fits should be performed from a variety of initial guesses. Even that does not guarantee you find the best answer. These programs are searching for a minimum in the total error (e.g., i(yfit – yi)2). They vary the parameters (in this case, I(0) and R) in a semi-intelligent way that quickly arrives at AN answer by a kind of guided trial and error process; however, the algorithm may not vary the parameters over a wide enough range to locate THE best solution. In this problem, you attempt to fix that by brute force. You are to write a GRID SEARCH program that adjusts I(0) and R over a range that will certainly include the smallest and largest possible values. Your program will probably consist of nested loops that vary I(0) and R over any reasonable range, using a reasonable step size for each parameter. You will use these values to calculate I(q), compute the sum of squared errors over all the data points at different angles, and then continue searching. When you find the lowest sum of squared errors, that is your answer. You can compare it to the answer from Solver. BTW, if all you had to do was fit a SINGLE set of data, this may seem to be a pretty stupid thing to do because you can just inspect the graph of the data and fitted curve from Solver to see whether the solution is a good one. You can also look at trends in the residual errors. Even so, a grid search program might be useful to try to locate other solutions (there is no guarantee that the Solver solution is the only one, even if it fits the data very well). Another reason for performing a grid search is that you might have thousands of I(q) vs. q plots spanning a wide range of I(0) and R values. This can happen if you are using light scattering to follow a self-assembly process. Our commercial Wyatt instruments can generate data at a rate of about 8 curves per second. We once built an apparatus that could operate about four times faster than this. In these cases, you don’t really want to look at all the thousands of curves and enter initial guesses for them. You might automate that process for something like Solver (e.g., an automated Marquardt fit with semi-intelligent first guesses) but given the speed of modern desktop computers, very reliable grid searches might be better.