## Tuesday, April 06, 2021

### [prnqdlyx] approximations among decimal powers of 10

combine the numerical coincidences 10^.3 ~= 2 and 10^.7 ~= 5 (equivalently 10^.1 ~= 2^(1/3) ~= 5^(1/7) ) in various ways, shifting by powers of 10 as necessary, to yield the approximations below.  multiple routes can result in disagreeing approximations.  for example, 10^-0.9 = 10^(0.7*3 - 3) = 5^3/1000 = 0.125 or 10^-0.9 = 10^(0.3*7 - 3) = 2^7/1000 = 0.128 .  the exact values (to 3 significant figures) are also included in bold.  the exact values can also be distinguished because they usually are not digit patterns from powers of two: 625 125 25 5 1 2 4 8 16 32 64 128 256 512.

inspiration was to determine whether 10^.8 ~= sqrt 40 is related to the above concidences.  it is, because we can derive (10^.8)^2 = 10^1.6 = 10 * 10^.6 ~= 10 * 4 = 40 from the table below.

10^-0.9 = 0.125
10^-0.9 = 0.126
10^-0.9 = 0.128
10^-0.8 = 0.158
10^-0.8 = 0.16
10^-0.7 = 0.2
10^-0.6 = 0.25
10^-0.6 = 0.251
10^-0.6 = 0.256
10^-0.5 = 0.316
10^-0.5 = 0.32
10^-0.4 = 0.398
10^-0.4 = 0.4
10^-0.3 = 0.5
10^-0.3 = 0.501
10^-0.3 = 0.512
10^-0.2 = 0.625
10^-0.2 = 0.631
10^-0.2 = 0.64
10^-0.1 = 0.794
10^-0.1 = 0.8
10^0.0 = 1
10^0.1 = 1.25
10^0.1 = 1.26
10^0.1 = 1.28
10^0.2 = 1.58
10^0.2 = 1.6
10^0.3 = 2
10^0.4 = 2.5
10^0.4 = 2.51
10^0.4 = 2.56
10^0.5 = 3.16
10^0.5 = 3.2
10^0.6 = 3.98
10^0.6 = 4
10^0.7 = 5
10^0.7 = 5.01
10^0.7 = 5.12
10^0.8 = 6.25
10^0.8 = 6.31
10^0.8 = 6.4
10^0.9 = 7.94
10^0.9 = 8

`perl -we 'for ( \$i = -4 ; \$i <= 9 ; ++\$i ) { for ( \$j = -4 ; \$j <= 3 ; ++\$j ) { \$x = 10 ** \$j * 2 ** \$i ; \$l = log ( \$x ) / log ( 10 ) ; next if ( \$l < -1.999 ) or ( 1.999 < \$l ) ; printf ( "%.1f %g\n" , \$l , \$x ) } } for ( \$i = -19 ; \$i <= 19 ; \$i++) { \$x = \$i / 10. ; \$y = sprintf ( "%.2e" , 10 ** \$x ) ; printf ( "%.1f %g\n" , \$x , \$y ) }' | sort -g | uniq`

next, we consider errors of a specific choice of approximation:

approx exact relative error min. range max. range
10^0.1 1.25 1.259 -0.71% 1.244 1.274
10^0.2 1.6 1.5849 0.95% 1.566 1.604
10^0.3 2 1.9953 0.24% 1.971 2.019
10^0.4 2.5 2.512 -0.47% 2.482 2.542
10^0.5 3.2 3.162 1.19% 3.1246 3.2
10^0.6 4 3.981 0.48% 3.934 4.029
10^0.7 5 5.012 -0.24% 4.952 5.072
10^0.8 6.3 6.310 -0.15% 6.234 6.3848
10^0.9 8 7.943 0.71% 7.849 8.038
10^1.0 10 10   0% 9.881 10.119

Pari/GP:

`a=[1.25,1.6,2,2.5,3.2,4,5,6.3,8,10] maxerror=(3.2-sqrt(10))/sqrt(10) ; for(i=1,10,x=a[i] ; y=10^(i/10) ; z=(x-y)/y*100 ; printf("<tr> <td>10^%.1f</td> <td>%5.2f</td> <td>%6.3f</td> <td>%5.2f%%</td> <td>%6.3f</td> <td>%6.3f</td> </tr>\n",i/10,x,y,z,y-maxerror*y,y+maxerror*y))`

the "approx" column is the aesthetically chosen approximation.  "exact" is to 3 (ish) decimal digits.  the largest relative error, 1.19%, happens at 10^0.5 = sqrt(10).  the min and max range columns gives the bounds for 1.19% error around all the exact values.

assuming we're not willing choose a more accurate approximation for sqrt 10 than 3.2, the aesthetic problem is to choose the "simplest" number in each range as the approximation.  should 10^.1 be 1.26 or 1.25 ?  should 10^.9 be 7.9 or 8 ?

previously, common logarithms, tenth root of ten, etc.