# Thread: Generate range of values exponentially

1. ## Generate range of values exponentially

I would like to generate S values from A to B both included, with a logarithmic or exponential increase between the values and I don't know which one could be a good formula to use, right now I'm using:

$m=B/A$
$f[1]=A$
$f[n+1]=n*(m^{1/S})$

It works well but it doesn't let me control how fast the curve grows, just the start, end and the number of steps. Is there a better one? I thought this would be a fairly used formula but I can't find a straightforward answer anywhere.

2. Hello, Berem!

I would like to generate S values from $A$ to $B$, both included,
with a logarithmic or exponential increase between the values.
Here's how I'd approach the log function . . .

Let: . $f(x) \:=\:p\ln(x) + q$

We are given: . $\begin{array}{c}f(1) \:=\:A \\ f(5) \:=\:B\end{array}$

Since $f(1) = A$, we have: . $p\ln(1) + q \:=\:A \quad\Rightarrow\quad q \:=\:A$

. . The function (so far) is: . $f(x) \;=\;p\ln(x) + A$

Since $f(5) = B$, we have: . $p\ln(5) + A\:=\:B \quad\Rightarrow\quad p \:=\:\frac{B-A}{\ln5}$

. . Therefore, the function is: . $f(x) \;=\;\frac{B-A}{\ln5}\,\ln(x) + A$

3. Thanks that logarithmic function works well.

Is it not possible to get a logarithmic or exponential function where as well as defining the start/end point and the number of values you want to get, you can also modify how fast or slow the curve grows?

I mean modify the curve from A to B so it generates more values near B or not so near to the point it almost looks like a line.

Maybe it's not possible to do this with exponentials/logarithmic curves and I should use another kind of curves, any ideas?