I've been trying to come up with a one-variable function that roughly matches this graph:

enter image description here

The closest I've gotten is $ f(d) = \dfrac{\log(c \cdot (1 - \frac{d}{c}))}{\log c} $, but this approaches $y=0$ at $x=c-1$, and steadily declines from $x=0$, instead of sharply.

Are there any functions or tricks I could look into to develop this further?

Thank you.

  • $\begingroup$ Have you tried piecewise-defined functions? This looks like you could approximate it well with a parabola near 0 (i.e., $1 - x^2$), a square root near $c$ (i.e., $\sqrt{c-x}$) and some thing like a third-degree polynomial or a rational function inbetween. $\endgroup$ May 6, 2012 at 17:11
  • 2
    $\begingroup$ Something like $\exp(-x^2)-1/(5-x) +1$ comes close. The exponential term gives you the "left part" of the graph (with the inflection point) and the $1/(5-x)$ term gives you the "right part". Now you can scale (replace $x$ with $ax$ to scale horizontally; multiply the whole thing by $a$ to scale vertically) this to obtain what you want. $\endgroup$ May 6, 2012 at 17:15
  • $\begingroup$ That's beautiful, @DavidMitra! Thank you very much, and for the explanation. $\endgroup$
    – theY4Kman
    May 6, 2012 at 18:03
  • 2
    $\begingroup$ You could also try doing something in polar coordinates. $\endgroup$ Jun 7, 2012 at 13:02

2 Answers 2


One thing might do is find a function $f$ whose graph is qualitatively the same as yours on the "left part", that is over $[0,C/2]$, say, and relatively constant on the right part, $[C/2, C]$.

Then find a function $g$ whose graph matches yours on the right part and is relatively constant on the left part.

Taking the sum $f+g$, you'll obtain a function whose graph is qualitatively the same as yours. The fact that $f$ and $g$ are nearly constant where they are is important, as this will insure that the sum $f+g$ will still have more or less the right shape.

However, the sum $f+g$ may not be 0 at $x=C$; you may need to vertically shift the function by adding a constant.

Here to get the bell shaped part on the left, you might use $f(x)=\exp(-x^2)$. For the shape of the right, the function $g(x)=.2|C-x|^{1/3}$ seems to work nicely.

So take $h(x)= \exp(-x^2) + .2|C-x|^{1/3}$. Even better would be $h(x)= \exp(-x^2) + .2|C-x|^{1/3} -\exp(-C^2)$, as this will insure that $h(C)=0$.

Well, that's almost right, except $h(0)$ is not $1$. But to ameliorate this, we can vertically scale, take $h(x)=a\bigl( \exp(-x^2) + .2|C-x|^{1/3} -\exp(-C^2)\bigr)$ where $a$ is chosen so that $h(0)=1$.

Actually, my choices of $f$ and $g$ are somewhat unsatisfactory (in particular, the function $g$ isn't nearly constant on the left part; perhaps the choice I made in my comment to your question ($g(x) = -{1\over C-x}$) would be a better choice). But I hope the method described is of help.


Let's try it in polar coordinates (as suggested by John).

We will start with a four petals flower getting the polar expression $$\rho=\frac{m-1+\cos(4\theta)}m$$ $m$ is a parameter and $m\approx 5$ seems appropriate giving :


In your case the graph will be obtained by $$x=C\rho \cos(\theta),\ y=\rho \sin(\theta)$$ To rewrite it with just one parameter you may use $\ u:=\cos(\theta)$ getting : $$\rho=\frac{m+8(u^4-u^2)}m$$ $$x=C\;\rho\;u,\ y=\rho \sqrt{1-u^2}$$

But $y$ is not a simple function of $x$ and worse the bump at the left is a little too large and the middle part not smooth enough... (but it had to be tried!)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .