I am searching for a function that would relate two variables approximately like the graphs below, but with a smooth curve.
The joint of the dark line above is where users can click with a mouse, thus specifying the function to be applied.
Both my variables, Tamanho
(size) and Nº spp
(species number) are within the range [0,1].
The curve should become an almost square near the corners, i.e. (Nº spp
~ 0 and Tamanho
~ 1) or (Nº spp
~ 1 and Tamanho
~ 0).
I have tried exponential functions, but they are not symmetrical.
I have also tried quadratic curves, but they goes outside the range [0,1] for Tamanho
, depending on where you click.
Question:
Does such function I'm looking for even exist? If not, what options do I have?
I'm going to include them all in my program (broken line, exponential…), so the bigger the number of options, the better.
Best Answer
Here is a perfect curve that meets all the requirements:
$$(1+a^2)(y-x)^2=a^2+(x+y)^2$$
where $a$ is a parameter that adjusts how sharp the turn is. The sample plot below is for $a=0.05$.
As seen in the graph, the function exists. It has the desired symmetry and stays within the unit range. In the limit $a\rightarrow 0$, a 90-degree corner turn (nearly a square) can be produced.
$$a=0.05$$