3
$\begingroup$

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

enter image description here

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).

$\endgroup$
6
  • 3
    $\begingroup$ It looks like a normal distribution. You might want to check that out. $\endgroup$ – Nigel Overmars Feb 17 '14 at 15:20
  • $\begingroup$ 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. $\endgroup$ – Supriyo Feb 17 '14 at 15:23
  • 1
    $\begingroup$ 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 :(. $\endgroup$ – span Feb 17 '14 at 15:24
  • 2
    $\begingroup$ 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. $\endgroup$ – dinosaur Feb 17 '14 at 15:35
  • 1
    $\begingroup$ @dinosaur very nice, thank you! $\endgroup$ – span Feb 17 '14 at 15:46
3
$\begingroup$

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}$.

$\endgroup$
1
  • 1
    $\begingroup$ Yay, 4 years later <3 $\endgroup$ – span Feb 19 '18 at 12:27
-1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ inverse cosine? inverse cosine is a monotonic function.. $\endgroup$ – Saketh Malyala Jun 21 '17 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.