Translating the apex of $-x^2$

119 Views Asked by At

I am attempting to write a function with the following properties:

The highest possible value is 100, and the further you get from a certain value, the lower the result the function will return... I created a simple bell-like curve by subtracting x^2 from an apex of 100:

$$f(x)=100-x^2 $$

I wanted the curve to span from 0 to 100, so I found it necesary to make the apex occur at x=50:

$$f(x)=100 - \frac{1}{25} \cdot (x-50)^2 $$

The function produces exactly what I'm looking for, but only for one value, 50. I would like to shift the apex horizontally while maintaining the x intercepts of 0 and 100. That is, I would like a curve similar to this one, except the apex can be any number greater than 0 and less than 100. Can this be accomplished simply?

1

There are 1 best solutions below

1
On BEST ANSWER

One choice is to squash your parabola on one side of the peak and expand it on the other. Say you want the peak at $m$. Let $$g(x)=\begin {cases} 50\frac xm & x \le m \\100-50\cdot \frac {100-x}{100-m}& x \ge m \end {cases}$$ and your function is then $$f(g(x))=100-\frac 1{25}(g(x)-50)^2$$