If you create the desired indexes against your input indexes, you will get a triangular shape. It turns out that for your case n = 10 this is
9.5 - abs(2 (x - 4.75))
Therefore, for general n this will be
n-0.5 - abs(2*(x - n/2-0.25))
Or in integer form,
(2*n-1 - abs(4*x - 2*n + 1)) / 2
This is completely flat, since your output indexes are generated using a single math function. I think that a general approach would be to draw the necessary indexes and look for a template and a way to represent it using mathematical functions.
Obviously, if your desired trailing indices form a straight line, then the conversion is simple. If you have a kink in the display, then you want to use the absolute value function to enter the kink, and you can adjust the scaling to change the rotation angle. You can tilt the kink by moving it (for example, abs(x)+x/2 ). If you need a jump gap in your final index function, then use the sign function (hopefully built-in, or use abs (x) / x). You need to be creative in using common function graphs to your advantage.
Adding
If your indexing function is piecewise linear, there is a simple algorithm. Suppose that the desired index function is expressed as a list of segments
{(sx1,sy1)-(ex1,ey1), (sx2,sy2)-(ex2,ey2), ... , (sxN,syN)-(exN,eyN)} segment 1 segment 2 segment N
where exK> sxK for all K and sxK> sx (K-1) for all K (put them from left to right).
k = 1 f(x) = Make affine model of segment k g(x) = f(x) Do: k = k + 1 h(x) = Makeaffine model of segment k If g(x) and h(x) intersect between ex(k-1) and ex(k) f(x) = f(x) + [slope difference of g(x) and h(x)] * ramp(x) Else f(x) = f(x) + (h(ex(k-1)) - f(ex(k-1))) * step(x) f(x) = f(x) + [slope difference of g(x) and h(x)] * ramp(x)
where ramp(x) = (abs(x)+x)/2 and step(x) = (sign(x)+1)/2 . f (x) means the given function, g(x) is the last affine model of the segment, and h(x) is the affine model of the current segment. The affine model is just a line in the form of a slope displacement: a*x+b , and the slope difference is the slope difference. This algorithm simply proceeds from the left right, adding the correct pieces of functions to it. The functions he adds are always zero for x <= 0 , so they do not affect the f(x) that has been created so far.
Of course, there may be some errors / typos. I really need to get to the meeting, so I can no longer write.