generating logarithmically distributed numbers

How do I generate N numbers from X to Y, distributed logarithmically?

For example, if I wanted 4 numbers from 1 to 10, distributed logarithmically, these numbers would be roughly 1, 2, 5, and 10. But I'd like to compute the exact numbers.
Who is Participating?

Commented:
e^(log(X)*i+log(Y)*(N-1-i))/(N-1)
for i=0..N-1
0

Commented:
e^(log(1),
e^(log(1)*2+log(10))/3
e^(log(1)+2*log(10)/2
e^log(10)
0

Commented:
e^(log(1),
e^(log(1)*2+log(10))/3
e^(log(1)+log(10)*2)/3
e^log(10)
0

Commented:
equivalently
Y * (X/Y)^(i/(N-1))
0

Author Commented:
Thanks, ozo, that got me most of the way there. I just needed to adjust your parentheses a little like this:

e^((log(X)*i+log(Y)*(N-1-i))/(N-1))
for i=0..N-1

I've attached some working C# code in case it will help anybody.

``````	// e^((log(X)*i+log(Y)*(N-1-i))/(N-1))
// for i=0..N-1
string s = "";
double X = 10;
double Y = 100;
double N = 5;
for (int i = 0; i < N; i++)
{
double value = Math.Exp((Math.Log(X) * i + Math.Log(Y) * (N - 1 - i)) / (N - 1));
s += value + "\r\n";
}
MessageBox.Show(s);
``````
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.