Equation for adjusting a scalar, trouble with fractional values

16 Views Asked by At

I have a real number - call it $s$, that I use to scale other numbers. Think $2\times$ scale $1/2\!\!\times$ scale, things of that nature (I am no math expert so please bear with my elementary explanation)

Occasionally I want to adjust the scale, tiny values - call them $\delta$, coming in over time that either increase or decrease $s$.

I certainly don't want s to reach $0$, as a scale of $0$ wouldn't make sense; the object being scaled would no longer exist!

Things are all well and good when I am increasing $s$, where $s > 1$. In this case I can just do something naive like $s + \delta$.

However, when $s$ drops below $1$, things get funky. It is no longer a linear scale anymore, $1\!\!\times$ scale to $1/2\!\!\times$ scale is a logical jump of "$1$", the same "distance" that one would go from $1\!\!\times$ scale to $2\!\!\times$, but in the other direction, but the actual distance between them is $0.5$, going further, smaller values become more and more significant, if that makes sense...

I attempted to solve this by saying when $s < 1$, $s/(1-\delta s)$. This is much closer to what I want, but it's not perfect! One obvious problem appears when $\delta s = 1$. Working through it logically, it seems to me like in those cases it should always result in a value of $2$.

Next, I started to consider how to better handle the transition point. We don't really want $s < 1$, because you could have $s \geq 1$, but a $\delta$ that produces an $s < 1$. While looking at this I discovered that my equation breaks down on $\delta > 1/s$.

I have been pursuing an equation for this as it seems like there should be an elegant mathematical solution to do something like this, but I don't think the path I'm headed down leads to elegance! I'm wondering if someone here with more expertise in math could enlighten me on the cleanest way to do this?