e^(log(1)*2+log(10))/3

e^(log(1)+2*log(10)/2

e^log(10)

Solved

Posted on 2009-02-17

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.

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.

5 Comments

e^((log(X)*i+log(Y)*(N-1-i

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);
```

Title | # Comments | Views | Activity |
---|---|---|---|

Lazy Loading not working in EF on all tables | 13 | 35 | |

Submitting to a REST API via a CLR in C# | 12 | 52 | |

Cannot convert sql query result in interger | 3 | 31 | |

The Using statement in C# | 5 | 19 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**14** Experts available now in Live!