# What function produces the pictured graph?

Quite simply, I need a function that will produce a graph similar to the one below. Important to note:

1) Y switches from negative to positive at X=1/3

2) Y ranges from -0.1 to +0.1, not to and from infinity

3) Y should be very close to 0 by X=1/6 and X=3/6.

4) It should have curves similar to those in the picture (Mod note: the original image link is dead, for context I'm replacing it with the graph of the function given in the accepted answer.)

A massive thank-you to whomever can figure this one out.

-

I would suggest

$$\frac1{5\pi}\mathrm{arccot}\left(c\left(x-\frac13\right)\right)$$

and adjust the value of $c$ to speed up or slow the rate of decrease.

Yet another alternative:

$$\frac1{10}\tanh\left(\frac1{c\left(x-\frac13\right)}\right)$$

-
This looks to be exactly correct (according to WolframAlpha's grapher), however, it seems Lua doesn't have an arccotangent function... – Taehl Jan 3 '11 at 14:28
@Taehl: $\mathrm{arccot}(x)=\arctan(1/x)$ – non-expert Jan 3 '11 at 14:33
I must be expressing this wrong... (1/(5*pi))*atan(1/(x-1/3)) seems incorrect... – Taehl Jan 3 '11 at 14:40
Looks good to me. – non-expert Jan 3 '11 at 14:54
The tanh one worked even better. Thank you very much. – Taehl Jan 3 '11 at 14:59

Do you need continuity when you go through $x=\frac{1}{3}$? If not, you can use $y=0.1 \exp(-a(x-1/3))$ for $x \gt \frac{1}{3}$

$y=-0.1 \exp(a(x-1/3))$ for $x \lt \frac{1}{3}$

Pick $a$ to make it fall as fast as you want

-
That was very close, and led me to a useable function - thank you! What I ended up with was: (n<1/3 and -.1^(-(n-1/3)) or .1^(n-1/3))/10) – Taehl Jan 3 '11 at 14:06

Using the Heaviside step function $H$, the following seems to be the simplest choice

$y=H(x-\frac13)(1-H(x-\frac12))(x-\frac12)^2-(1-H(x-\frac13))H(x-\frac16)(x-\frac16)^2$

-