Need a formula for curve.

208 Views Asked by At

I need a function which give 0 for 0 value and 100 for 100 but is a highly curvy curve, like for 0.001 it should give value like 1.2 and for 50 it show give value like 55 and ultimately for 100 it should be 100.

In short it increases rapidly for smaller value of x, and slowly for large value of x. and ultimately same value as input.

2

There are 2 best solutions below

2
On BEST ANSWER

Lots of curves can have this property. Here's a simple parameterized family of curves that do what you want:

$$y = 100 \left ( \frac{x}{100} \right )^n$$

Where $n$ is a parameter ranging from $0$ (exclusive) to $+ \infty$, and $x$ is your value, from $0$ to $100$.

For $n = 1$, you just get a straight line (least curvy). Otherwise, the closer $n$ is to $0$, the more "curvy" it is and increases quickly with small values of $x$, then slows down, and for $n > 1$ it's the opposite.

Note that "curviness" is not a linear relationship of $n$, but more an inverse relationship. For instance, $0.05$ is really curvy, but $1.05$ is almost flat - to obtain the same amount of curviness in both directions, you would use $\frac{1}{0.05} = 20$.

As you can see, it always starts at $0$ when $x = 0$, and ends at $100$ when $x = 100$.


Examples:

$$n = 0.1$$

enter image description here

$$n = 0.5$$

enter image description here

$$n = 1$$

enter image description here

$$n = 5$$

enter image description here


This can be generalized a lot, feel free to build on it if you need to tweak it.

0
On

For "increases rapidly for smaller value of x, and slowly for large value of x" one possibility would be $$\sqrt{x(200-x)}$$ so the graph of the function looks like a quarter circle.

For $x=0.001$ this gives about $0.44$ and for $x=50$ it gives about $86.6$, but can easily be adjusted.