1

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?

  • Do you have any other conditions on the function? Does it need to be differentiable? Can it be piecewise? You will not be able to make a quadratic function with the desired properties. The apex of a parabola occurs midway between the intercepts (if they exist). – Kris Williams May 14 '13 at 20:30
  • No other conditions, just the same x intercepts and the same y value for the apex. So, if there is no quadratic function to satisfy my conditions, I can either simplify my conditions or complicate my solution. Thanks for your help! – ridthyself May 15 '13 at 11:22

1 Answers1

1

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

Ross Millikan
  • 374,822
  • This makes good sense, probably the easiest way. Essentially I would have two funtions, one for each greater and lesser than m. Programming this shouldn't be difficult at all. Thanks for your insight. – ridthyself May 15 '13 at 11:28