# Formula for a convex function

I am looking for a formula $y_i = f(i, \kappa)$, for $i=1...K$ data points, that generates a convex function like this one:

The function should contain a parameter, e.g. $\kappa$ that can handle the amount of convexity. Ideally, setting this parameter to a certain value should give equal weights (e.g. $y_i = y_j$ for all $i=1...K$)

• Are $y_i$ data points? Is so, they are given and the property of adding up to 1 is either given or not. – Hellen Sep 28 '17 at 14:35
• No $y$ is not given. $x_i$ is just 1...K. Maybe I should rewrite it as $y_i = f(i, \kappa)$ – JohnAndrews Sep 28 '17 at 14:50

You can combine basic convex functions, e.g. $$y_1(x) = \sum_{i=1}^K (x-i)^2$$ and then renormalise them to obtain $$y(x) = \frac{y_1(x)}{\sum_{i=1}^K y_1(i)}$$
• @JohnAndrews depends on what you want exactly. You could try with weighting the terms in the sum, or scaling using $(cx-i)$, or increasing the powers to $(x-i)^{2+c}$ (for $c>0$), or in a million other ways. I'd go with the first option. – TZakrevskiy Sep 28 '17 at 15:09
• If you are scaling $x$, then for $c=0$ the function $y(x)$ is constant. – TZakrevskiy Sep 28 '17 at 15:23