For context, I'm trying to write a stock-trading bot which can distribute N sell orders across a range of prices for a stock, starting at the current price and ending at some higher price. I'm trying to come up with some equation to generate the N prices along the range, such that I am able to weight the prices towards one side or the other based on a single variable W.
The "linear" case (as I've been calling it in my head), where the prices have an even distribution along the range, is easy enough. Let's say the range is from 0 to 12, and I want N=5 prices along the range:
No weighting (W=1?): [0, 3, 6, 9, 12]
The other cases I can't figure out. I'd like to be able to "weight" the prices towards one side or the other:
Weighted to the right (W>1?): [0, 4, 8, 10, 12]
Weighted to the left (W<1?): [0, 2, 4, 8, 12]
Those numbers are obviously not exact, I'm just trying to show the general idea. I'm not looking for someone to fully solve flesh out the equation for me, just a nudge in the right direction would be greatly appreciated. Thanks!
You can split the exercise up into parts
If you want $n$ equally spaced numbers from $0$ to $1$, you could try $\frac{0}{n-1}$, $\frac{1}{n-1}$, $\frac{2}{n-1}$, ... , $\frac{n-2}{n-1}$, $\frac{n-1}{n-1}$
If you have a number $x \in (0,1)$ then $x^{1/w}$ would be closer to $1$ when $w>1$ and $x^{1/w}$ would be closer to $0$ when $0 \lt w \lt 1$
If you have a number $x \in [0,1]$ and you want an equivalent number $y$ in $[a,b]$ then you could try $y=a(1-x)+bx$
For example with $n=5, w=2, a=0, b=12$ you would get $12\times\left(\frac{0}{4}\right)^{1/2},12\times\left(\frac{1}{4}\right)^{1/2},12\times\left(\frac{2}{4}\right)^{1/2},12\times\left(\frac{3}{4}\right)^{1/2},12\times\left(\frac{4}{4}\right)^{1/2}$ which would be approximately $0,6,8.49,10.39,12$