# Is there a simple smooth non-piecewise function that could replace this piecewise one

I need a function which satisfies these conditions:

• $f(0) = 0,$
• $f(x)$ is monotonically increasing for all $x > 0,$
• for some specified $x_2 > x_1 > 0$ and $y_2 > y_1 > 0,$ $f(x_1) = y_1,$ and $f(x_2) = y_2.$

I can construct $f(x)$ easily using a piecewise linear function that passes from the origin to the points $(x_1,y_1)$ and $(x_2,y_2)$ in turn, then continues to monotonically increase at some arbitrary rate. However, I am concerned at possible effects of the non-continuous curvature. Is there a better alternative to using spline curves that might give both a smooth curve and a non-piecewise function?

-

## 1 Answer

Have a look at the function: $f(x)=y_1 \cdot (x/x_1)^p$, where $$p=\frac{\ln(y_2/y_1)}{\ln(x_2/x_1)}.$$ It is monotone increasing for positive $x$, given that $0<x_1<x_2$ and $0<y_1<y_2$ which makes the two log terms in the exponent $p$ both positive. And it passes through the three points $(0,0),\ (x_1,y_1),\ (x_2,y_2)$.

As a power function, it looks to be smooth, at least for positive $x$. It may have a kink at $x=0$ though; maybe a variation of this idea could remove such a kink.

-
Apparently I'm too new here to upvote your answer, but that looks great. I cannot see the potential for a kink at x=0 myself - the two ratios are always greater than 1, so the two log terms are both positive. The ratio p therefore ranges from 0 < p < infinity. I can't see a kink developing in that, unless I venture into the x < 0 range, which does not concern me - it can go completely nuts for all I care :-) – omatai Feb 21 '13 at 20:30
When $0<p<1$ the derivative of the above $f(x)$ is undefined at $x=0$. In that case geometrically the curve has a vertical tangent at $0$ e.g. compare $y=\sqrt{x}$, and I didn't know whether this is a concern for your application. But at $x>0$ the function is well behaved. – coffeemath Feb 21 '13 at 21:55
That should be fine for my purposes - thanks! – omatai Feb 21 '13 at 22:12