# creating smooth curves with f(0) = 0 and f(1) = 1

I would like to create smooth curves, which have f(0) = 0 and f(1) = 1.

What I would like to create are curves similar to the gamma curves known from CRT monitors. I don't know any better way to describe it, in computer graphics I used them a lot, but in math I don't know what kind of curves they are. They are defined by the two endpoints and a 3rd point.

What I am looking for is a similar curve, what can be described easily in math. For example with a simple exponential function or power function. Can you tell me what kind of curves these ones are (just by lookin at the image below), and how can I create a function which fits a curve using the 2 endpoints and a value in the middle?

So what I am looking for is some equation or algorithm what takes a midpoint value f(0.5) = x, returns me a, b and c for example if the curve can be parameterized like this (just ideas):

a * exp (b*t) + c


or

a * b^t + c


Update: yes, x^t works like this, but it gets really sharp when t < 0.1. I would prefer something with a smooth derivatie at all points. Thats why I had exponential functions in mind. (I use smooth here as "not steep")

-
How about $f(x)=x^t$ where $t$ is a positive real constant? This has $f(0)=0$ and $f(1)=1$, and if $f(0.5)=k$ where $0<k<1$ then I guess $0.5^t=k$, so $t=-\log_2 k$. –  mac Jul 7 '11 at 9:36
Great minds think alike, we even agree on notation. :) –  Har Jul 7 '11 at 9:39
Yes, its correct, but it gets really sharp when t < 0.1. I would prefer something with a smooth derivatie at all points. Thats why I had exponential functions in mind. –  zsero Jul 7 '11 at 9:45
FYI a "smooth function" actually has a technical meaning: en.wikipedia.org/wiki/Smooth_function –  Michael McGowan Jul 7 '11 at 13:40

EDIT

It turns out that for $0 < x < 1$ with $x \neq 0.5$, the function $f(t)$ as given in the original answer below can be simplified very much. (The key observation is that $\sqrt {1 - 4x(1 - x)} = \sqrt {(2x - 1)^2 } = |2x - 1|$.) Specifically, for any $0 < x < 1$ with $x \neq 0.5$, $$f(t) = \frac{{(\frac{{1 - x}}{x})^{2t} - 1}}{{(\frac{{1 - x}}{x})^2 - 1}}.$$ Note that $f(0)=0$, $f(1)=1$, and $$f(0.5) = \frac{{\frac{{1 - x}}{x} - 1}}{{(\frac{{1 - x}}{x})^2 - 1}} = \frac{{\frac{{1 - 2x}}{x}}}{{\frac{{1 - 2x}}{{x^2 }}}} = x.$$ Since $f$ is, loosely speaking, an exponential function on a bounded domain, it has a bounded derivative, as the OP wants.

If $x=0.5$, then take $f(t)=t$. If $0 < x < 1$ and $x \neq 0.5$, take $$f(t) = \frac{{e^{bt} - 1}}{{e^b - 1}},$$ where $$b = 2 \ln (\xi)$$ with $$\xi = \frac{{1 + \sqrt {1 - 4x(1 - x)} }}{{2x}}$$ if $x < 0.5$ and $$\xi = \frac{{1 - \sqrt {1 - 4x(1 - x)} }}{{2x}}$$ if $x > 0.5$. Then $f(0)=0$, $f(1)=1$, and $f(0.5)=x$ (and $f$ has a bounded derivative, as you want).

-
Perfect! Thank you! It gives me exactly the kind of functions I was thinking! –  zsero Jul 7 '11 at 12:01
Thx! Even better! –  zsero Jul 7 '11 at 13:50

How about $f(x)=x^t$ for some $t>0$? It satisfies $f(0)=0$ and $f(1)=1$ for any $t$.

All that is left is to pick $t$. For example, if you want that $f(b)=a$, then we get $b^t=a$, or $t = \log(a)/log(b)$.

Edit: In particular, if we denote $f_t(x)=x^t$, we have that $f_{2.2}(0.5)=0.218$ and $f_{1/2.2}(0.218)=0.5$. In other words, it is clear from the numbers and the general shapes of the curves that they are exactly $f(x)=x^t$.

-
Yes, its correct, but it gets really sharp when t < 0.1. I would prefer something with a smooth derivatie at all points. Thats why I had exponential functions in mind. –  zsero Jul 7 '11 at 9:45
It seems to me that the dashed line in the picture also has this problem. I'm willing to bet that the graphs in the picture were actually $x^t$. I might be wrong but I like my odds. :) –  Har Jul 7 '11 at 10:02
Also, note that $0.5^{2.2}=0.218$, so the numbers in the picture support this hypothesis. –  Har Jul 7 '11 at 10:04
OK, you are right with the particular numbers, but I was just using this graphic to describe the problem I was into. If you plot a function from Shai Covo's answer you can see its shape is really different as x gets closer to 0 or 1. –  zsero Jul 7 '11 at 12:04
Fair enough. Hard for me to know exactly what you were looking for, I was just trying to create "curves similar to the gamma curves known from CRT monitors" (as given by the picture). –  Har Jul 7 '11 at 12:07