I'm trying to jog my memory of calculus from 10 years ago and it's proving a bit difficult. I'm hoping someone can give me a push in the right direction here. I've found a number of good resources online, but they're all either too far abstracted from my problem or too advanced. The concrete problem that I'm trying to solve is the following:
I'm writing a pagination function that uses $13$ discrete steps, i.e. there will be a maximum of $13$ links shown, regardless of number of pages. Now say I have $n$ total pages, and I'm on page $p$ where $1 \leq p \leq n$ (and for the sake of this discussion, $n > 13$). I need an equation that will yield $13$ links from $1$ to $n$, with the $6$ links immediately surrounding $p$ being pretty much linear - i.e., $45, 46, 47, 48, 49, 50, 51$ where $p = 48$ - and with the first and last step being the bounds - i.e., $1$ and $13$, respectively.
It looks to me like this would be something along the lines of $(x-s)^3/u + p$, where $s$ is the current discrete step (between $1$ and $13$) and $u$ is some variable that I don't know how to derive. I managed to come up with a quadratic equation that I could force to intersect with $(s,n)$, but I then I got lost trying to integrate it to achieve my cube equation..... I don't know, maybe I'm going way off in the wrong direction with all this.
Really, this specific problem isn't the focus here. I've come up against this type of problem a number of times now and what's really bugging me is that I know there's an elegant mathematical way to solve it, but I can't figure out how. I'm basically trying to "mash" a graph into the given boundaries. The simplest way to think of it is to start with $f(x) = x^2$. This intersects $(-3,9)$ and $(3,9)$. Now say I want to move the vertex up to $(0,5.5)$, but I still want the graph to intersect those same two points. Then I want to move the vertex to $(1.2,5.5)$, but still intersect those points. See what I mean? It seems like the kind of thing where someone will come along and say "Oh, that's easy; you just do this, then plug in your numbers, then take the derivative of that" or something, but so far I haven't found that to be the case. Maybe I'm assuming this is much more trivial than it actually is. Am I wrong in thinking this shouldn't be terribly complicated?