Parabola always through two points.

You can simply set up a system of equations in the quadratic form:

$$y=ax^2+bx+c$$

So plugging in $x$ and $y$ from your points $(0,0)$ and $(1,1)$, you make two equations:

$$0=a(0)^2+b(0)+c$$ $$1=a(1)^2+b(1)+c$$

The equations simplify to:

$$c=0$$ $$1=a+b$$

So the $c$ of your quadratic equation will be always 0. $a$ is your "width" of the parabola. The lower the value, the wider it is, the higher the value, the narrower it is. Just remember that whatever $a$ you chose, you have to chose $b$ so that $a+b=1$ as can be seen in the second equation.

To get the equation in terms of $W$ simply complete the square and manipulate the standard quadratic form (note that $c$ is $0$, so we exclude $c$):

$$y=ax^2+bx$$ $$y=a\Big(x^2+\frac{b}{a}x\Big)$$ $$y=a\Big(x+\frac{b}{2a}\Big)^2-\frac{b^2}{4a}$$

Now, since $a+b=1$ then $b=1-a$:

$$y=a\Big(x+\frac{1-a}{2a}\Big)^2-\frac{(1-a)^2}{4a}$$

Now, simply define $W=\frac{1}{a}$ and the equation will change into:

$$y=\frac{\big(x+\frac{W-1}{2}\big)^2}{W}-\frac{(W-1)^2}{4W}$$

Then, combine the two fractions into one and expand exponent:

$$y=\frac{4\Big(x^2+(W-1)x+\frac{(W-1)^2}{4}\Big)-(W-1)^2}{4W}$$ $$y=\frac{4x^2+4(W-1)x}{4W}$$ $$y=\frac{x^2+(W-1)x}{W}$$ $$y=\frac{x^2}{W}+\frac{(W-1)}{W}x$$

And that's it! We derived the equation in terms of $W$. Now, simply to change the width of the parabola, you change $W$. The bigger $W$, the wider the parabola, the lower $W$, the narrower the parabola. (Opposite of what happens if you change $a$ because we defined $W=\frac{1}{a}$). The parabola will rest on the points $(0,0)$ and $(1,1)$ as expected.

Also, notice what happens when you increase $W$ to infinity. With some further analysis, and taking $\lim_{W\to\infty} y$, you can see that the equation slowly becomes the line $y=x$, which is exactly what you predicted and wanted!

Note: If you would ever need three points instead of two, you won't be able to change the width of the parabola because three points describe exactly one parabola. With two points you have infinite parabolas, hence the ability to change width.


EDIT: I was answering it fast, and now I realized, that you don't have to complete the square at all! You simply need to start with:

$$y=ax^2+bx$$

Then just plug in $b=1-a$, and then $a=\frac{1}{W}$:

$$y=ax^2+(1-a)x$$ $$y=\frac{x^2}{W}+\Big(1-\frac{1}{W}\Big)x$$ $$y=\frac{x^2}{W}+\frac{(W-1)}{W}x$$

Sorry for making it more complicated than it should be.


I think $$ f(x) = \frac{x(x-1)}{W} + x $$ will do what you want.

For large $W$ this will be nearly straight between the two points you specified. For very large $x$ (positive or negative) it will grow without bound.

(This is what happens if you finish the algebra that @KKZiomek started.)