# Creating a function from graph

I'm trying to create a function that will generate a graph similar to this awesome paint gif:

This is my attempt thus far: f(x)=-0.0040*(x+200)*(x-200)

I can't figure out how to get my graph to "turn" and go to 0 like in the picture. I've tried different types of absolute values and I guess I could make two separate functions. If it is possible, I really would love to be able to express it in a single function though. Note that the exact values are not that important, I can tweak them later. The shape of the graph is really what I'm looking for (disregarding my artistery with uneven lines).

• It looks like a normal distribution. You might want to check that out. Feb 17, 2014 at 15:20
• If you know the value of the functions at some points on the graph (If you have it very definitely) you may try for a polynomial interpolation and you may get an approximation of the function. Feb 17, 2014 at 15:23
• Thanks, it is a normal distribution. I've had a look at how it is constructed but I can't get my head around how to get the y-value rather then the area in the graph. The wikipedia is too complicated for me to grasp it :(.
– span
Feb 17, 2014 at 15:24
• In $$f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left(-\frac{1}{2} \left(\frac{x-\mu}{\sigma}\right)^2\right)$$ the parameters $\mu$ and $\sigma$ define the placement of the graph: $\mu$ determines the $x$-coordinate of the maximum value (since yours is at $x=0$ you have to use $\mu=0$) and $\sigma^2$ determines the $x$-value of the point of inflection. I think yours is around $\sigma\approx 100$. You still might have to scale your $y$-values, though. Feb 17, 2014 at 15:35
• @dinosaur very nice, thank you!
– span
Feb 17, 2014 at 15:46

Two possible guesses.

Probability Density: $\large y=ce^{-\left(\frac{x-k}{h}\right)^2}$

I don't know what a name for this is, but another similar graph is $\displaystyle y=\frac{c}{1+(h(x-k))^2}$.

• Yay, 4 years later <3
– span
Feb 19, 2018 at 12:27

This looks like an inverse Cosine graph translated vertically by 1 unit. It also looks quite dilated as (x E [-200,200]), therefore its dilation factor should be π/200. f(x) = cos(π/200 x)+1 Since you didn't mention the y-intercept, I cannot be sure of its amplitude.

• inverse cosine? inverse cosine is a monotonic function.. Jun 21, 2017 at 8:38