Calculate base and coefficient for power curve through 3 non-linear points

347 Views Asked by At

I have a formula that takes a 0-based bounded single dimensional input and transforms it to a specific power curve.

EDIT

This is single dimensional. There is no $y$. In the image, I'm showing how the $x$ input is transformed. The only way to show this is to simulate it in the $y$ dimension. Technically, the graph should be shown stepped, but this is inconsequential to what I need.

If this isn't clear, then simply consider the curve to be a straight line with 3 points.

Looking at the image within the context of the input:

$k$ represents the number of buckets; this is logarithmic bucketing & I'm dividing A-C into $k$ logarithmic buckets; $k$ is predefined.
$A$ is always $0$ and is the lower bound.
$B$ maps to an output of 1, meaning the second bucket (0 is first); it is the beginning point of the second bucket; $B$ is predefined.
$C$ is the upper bound target, always +; $C$ is predefined.

Power Curve with 3 Non-Linear Points

The output $z$ is calculated as: $$z=\lfloor log_b(xR+1) \rfloor$$ where $$R=\frac{b^k-1}{C}$$

I need to determine $b$ based on $C$, $k$, and $B$. I worked out a recursive approximation algorithm, but I would prefer a formulaic solution.

EXAMPLE

$C=17987547480$
$k=128$
$B=0.000001$
$b=1.3280368123342627$
$R=328036.81233426905$

The difficulty is that $b$ and $R$ need to be simultaneously solved.

1

There are 1 best solutions below

3
On BEST ANSWER

The curve $z=\log_b(xR+1)$ has $z(0)=0$ and $z(C)=k$ provided $R$ is defined as $$R=\frac{b^k-1}{C}.\tag{1}$$ From a comment it appears you want $B$ to denote the value of $x$ at which $z(x)=1$, and since $z$ is defined as a log base $b$ this means that at $x=B$ the input of the log should be $b$ [since $\log_b(b)=1$]. This gives $BR+1=b$ or $$R=\frac{b-1}{B}.\tag{2}$$ Now from your example and the post, $k$ is known (there are $k$ or $k+1$ buckets, depending on whether bucket $0$ counts). It also appears you want to set the value $B$ yourself, as the $x$ value at which the curve $z$ first reaches $1$, and that the value $C$ is also regarded as known. With $B,C$ taken as known, either formula determines $R$ provided only we can find $b.$ Equating the right sides of $(1)$ and $(2)$ and rearranging, we have $$\frac{b^k-1}{b-1}=\frac{C}{B}.\tag{3}$$ For even moderately large $k$ this is really a polynomial equation for $b$ of large degree, so there seems little hope for a closed form solution giving $b$ as a formula in terms of $C,B.$ One could carry out the division on the left of $(3)$ and get the polynomial $$1+b+b^2+\cdots +b^{k-1},$$ or perhaps save some notation by rewriting $(3)$ as $$b^k -(C/B)b+(1-C/B)=0.$$ Either way it remains a problem of solving a large degree polynomial equation.