# How can I get exactly 5 logarithmic divisions of an interval?

I'd like to get exactly 5 divisions from x to y on a log scale. Can FindDivisions do this?

-

Writing one wouldn't be that hard. You can convert it to Log10 and then let FindDivisions do all the work in log space before converting it back. For example:

findLogDivisions[{xmin_, xmax_}, n_Integer] := 10^FindDivisions[Log10@{xmin, xmax}, n]


Then, to find 4 "nice" divisions in log space between 1 and 1000, you simply need to do:

findLogDivisions[{1, 1000}, 5]
(* {1, 10, 100, 1000} *)

-

I built a function that calculates log spaced increments for a job at work. I've added a catch where it will handle log spacing from 0 to a number.

logspace [increments_, start_, end_] := Module[{a}, (
a = Range[0, increments];
Exp[a/increments*Log[(end - start) + 1]] - 1 + start
)]


To try it out:

N@logspace[5,1,1000]

(*{1., 3.98107, 15.8489, 63.0957, 251.189, 1000.}*)


To view it on a number line:

a = N@logspace[10, 0, 10];
Graphics[Point@Transpose[{a, ConstantArray[.5, 11]}], Axes -> {True, False},

And if you want to find the distances between divisions, use Differences:
Differences[a]