I’ve zipped, renamed, and attached an Excel spreadsheet that lets you set a Min, Max, Steps, and Scaling and then calculates the resultant steps. That way if anyone wants to play around to see for themselves how it would be helpful, they can. (If someone really wants to play around with it but doesn’t have Excel, I can port it to a Google Sheets spreadsheet. Just ask.)
StepSpacing.RenameTo.zip.NotReallyA.txt (12.8 KB)
So, let’s say I’ve got a value (speed in mm/s? fiber laser frequency in kHz? whatever) that’s somewhere between 20 and 4000. I want to find an approximate target value for it, as I have no idea where it’s going to lie within that range. I’ll arbitrarily choose a few correct answers and show how the search would go with each approach (linear and logarithmic spacing), and the result doesn’t have to be exact, just close enough – this is for searching, not necessarily final fine tuning.
Case 1: Final answer will be 1500.
Min |
Max |
Steps |
Scaling |
1 |
2 |
3 |
4 |
5 |
20 |
4000 |
5 |
Linear |
20 |
1015 |
2010 |
3005 |
4000 |
1015 |
2015 |
5 |
Linear |
1015 |
1265 |
1515 |
1765 |
2015 |
— |
— |
— |
— |
— |
— |
— |
— |
— |
20 |
4000 |
5 |
Log |
20 |
75 |
283 |
1064 |
4000 |
1064 |
4000 |
5 |
Log |
1064 |
1482 |
2063 |
2873 |
4000 |
For values in the “middle” to top of the range, there may not be much benefit for a logarithmic search. A linear search does give more points over the top of the range, after all.
Case 2: Final answer will be 50.
Min |
Max |
Steps |
Scaling |
1 |
2 |
3 |
4 |
5 |
20 |
4000 |
5 |
Linear |
20 |
1015 |
2010 |
3005 |
4000 |
20 |
1015 |
5 |
Linear |
20 |
269 |
518 |
766 |
1015 |
20 |
269 |
5 |
Linear |
20 |
82 |
145 |
207 |
269 |
20 |
82 |
5 |
Linear |
20 |
36 |
51 |
67 |
82 |
— |
— |
— |
— |
— |
— |
— |
— |
— |
20 |
4000 |
5 |
Log |
20 |
75 |
283 |
1064 |
4000 |
20 |
75 |
5 |
Log |
20 |
28 |
39 |
54 |
75 |
Thanks to the math, a logarithmic search will work basically identically regardless of where in the range the final answer may be. On the other hand, the linear search pattern is drastically worse for values the closer they are to the bottom of the range.
Think about a logarithmic search as being akin to hunting for a ballpark by choosing an arbitrary starting point and then either doubling or halving your value until something different happens. (That is, after all, a logarithmic search.) No matter what your answer is, you’ll get to it very quickly.
Anyway, it’s not universe-altering or anything, but the utility is indisputable for initial parameter searches. As one more illustration, consider a parameter that has a possible range of 10 to 10,000:
Scaling |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Linear |
10 |
1120 |
2230 |
3340 |
4450 |
5560 |
6670 |
7780 |
8890 |
10000 |
Log |
10 |
22 |
46 |
100 |
215 |
464 |
1000 |
2154 |
4642 |
10000 |
If your first 10-step scan is logarithmic, you’ll have a decent range for your second scan no matter where in the range the parameter ends up. If your first 10-step scan is linear and the parameter ends up near the bottom of the range, life stinks.
Well, there’s my bit more background to support my case. This reminds me of back in college for my ChemE degree, hehe.