I need a function with a specific shape:
- Quadratic/gaussian concave shape ($-x^2$ like)
- Centered in $\frac{1}{2}$ where it reaches the max value 1
- On
0and1to become null
I first tried using a second-degree polynomial function and I failed.
By repeated tries on graph.tk, after I deduced on paper that $c=0$, I got $-4x^2+4x$ to be what I need.
Then I found the function $e^{-x^2}$ which have a very nice shape.
But now I have to span it in $[-0.5, 0.5]$ and add an offset.
$e^{-(x-0.5)^2}$ is centered in $\frac{1}{2}$ where it reaches 1, but it does not descend down to zero in 0 and 1.
I'm interested in either the solution to this problem and in the process of reaching that solution. How is this usually done?
If Q above is unclear:
How do I model $e^{-x^2}$ to meet the requirements in bullets above?
Well you're almost there. You have your nice function centered on $x=\frac{1}{2}$:
$$f(x)=e^{-(x-\frac{1}{2})^2}$$
Now you can compute $f(0)$ and $f(1)$ which will be equal because $f$ is symmetric around $x=\frac{1}{2}$:
$$\large f(0)=f(1)=e^{-\frac{1}{4}}$$
If you want $f(0)=f(1)=0$ you just have to write:
$$f(x)=e^{-(x-\frac{1}{2})^2}-e^{-\frac{1}{4}}$$
But now for $x=\frac{1}{2}$, your function is equal to $\large1-e^{-\frac{1}{4}}$
Just multiply it by $\large\frac{1}{1-e^{-\frac{1}{4}}}$ and here you go:
$$\large f(x)=\frac{e^{-(x-\frac{1}{2})^2}-e^{-\frac{1}{4}}}{1-e^{-\frac{1}{4}}}$$
Here's the plot of this function: