{ version = 1.02; (* of logscale.p 2010 Sep 18} (* begin module describe.logscale *) (* name logscale: provide numbers on a log scale synopsis logscale(input: in, output: out) files input: one line with the following values: x (real): starting value b (integer): base of the scale (eg 2 or 10) n (integer): number of intervals If n is negative, report the program version number. m (integer): which interval we are on w (integer): width of output number (characters) d (integer): decimal places of output number (characters) output: messages to the user description Create numbers on a log scale one at a time for use in scripts. Let the scale look like this (where b = 10): x * z * z * z * z = 10x So here x is the starting value. It is successively multiplied by z n = 4 times until we reach 10x. So for m = 0 result = x m = 1 result = x * z m = 2 result = x * z * z m = 3 result = x * z * z * z m = 4 result = x * z * z * z * z So now all we need to know is the value of z. From the first equation, z^n = b so z = b ^ (1/n) then: result = x * z^m examples The tcsh script: set m = 0 while ($m < 13) # x (real): starting value # b (integer): base of the scale (eg 2 or 10) # n (integer): number of intervals # m (integer): which interval we are on # w (integer): width of output number (characters) # d (integer): decimal places of output number (characters) printf "%2d " $m # x b n m w d echo "1 2 4 $m 4 2" | logscale @ m = $m + 1 end gives: 0 1.00 1 1.19 2 1.41 3 1.68 4 2.00 5 2.38 6 2.83 7 3.36 8 4.00 9 4.76 10 5.66 11 6.73 12 8.00 output: messages to the user description Create numbers on a log scale one at a time for use in scripts. Let the scale look like this (where b = 10): x * z * z * z * z = 10x So here x is the starting value. It is successively multiplied by z n = 4 times until we reach 10x. So for m = 0 result = x m = 1 result = x * z m = 2 result = x * z * z m = 3 result = x * z * z * z m = 4 result = x * z * z * z * z So now all we need to know is the value of z. From the first equation, z^n = b so z = b ^ (1/n) then: result = x * z^m examples echo " documentation documentation see also author Thomas Dana Schneider bugs technical notes *) (* end module describe.logscale *) {This manual page was created by makman 1.44}{created by htmlink 1.55}