I want to fill a range between two values, not linearly but exponentially. For this I use a starting value L take exponent R, and repeat for N number of steps.
L = 1e-7
R = 0.9997 # needs solving
N = 1000
for _ in range(N):
L = L ** R
>>> L
6.523-06
Need to solve for R such that end value of L after N repeats is 1e-05.
Edit: This is not the same question as suggested. In the linked question the formula linked is $
f(x) = a \times r^s.$ For my question, the formula is different:
$L[t] = L[t-1]^R$ where t is a recursion step with maximum steps N.
Let $c=10^{-7}$, $N=1000$ and $C=10^{-5}$ be the constants from the questions. Recall that $(c^R)^R=c^{R\cdot R}=c^{R^2}$, further $$((c^R)^R)^R=(c^{R^2})^R=c^{R^2\cdot R}=c^{R^3}$$ and so on. Thus, the program computes $c^{R^N}$ and the task is to solve $$c^{R^N}=C$$ for $R$. Taking the logarithm on both sides yields $$R^N\log c=\log C.$$ With basic transformations we get $$R=\left(\frac{\log(C)}{\log(c)}\right)^{1/N}.$$ This is the general solution. For the given numbers this yields $R=(5/7)^{0.001}$.