0

I'm trying to find a method to turn a value (that can reach a maximum of N) into a percentage. But I don't want it to be linear, I need it to be non-linear like the in this graph:

graph

HDNW
  • 103

2 Answers2

1

Generally, any function that fits the following qualifications will be somewhat similar to the graph:

  1. Increasing from $x = 0$ to $x = N$
  2. Concave from $x = 0$ to $x = N$
  3. $f(0) = 0$ and $f(N) = 100$

To keep things simple, we can use a function that is twice-differentiable. Then, we need $f'(x) > 0$ for $x\in (0,N)$, and $f''(x) < 0$ for $x\in (0,N)$.

There are a lot of options out there for functions that fit these requirements, but two easy ones to implement are

  • $f(x) = 100-\frac{100}{N^2}(x-N)^2$
  • $f(x) = 100\sqrt{\frac{x}{N}}$
Amaan M
  • 2,790
  • @OP The gamma correction for color adjustment is a typical non linear function, i.e. $\left(\frac xN\right)^\gamma$. Here we just flip it and scale it so that $f(0)=0$ and $f(N)=100$, so it become $100\left(1-\big(1-\frac xN\big)^\gamma\right)$. https://www.desmos.com/calculator/787gqjm0ov – zwim Feb 20 '21 at 21:43
0

Set $$f(x)=\frac{200 x}{N}-\frac{100 x^2}{N^2}$$ where $N$ is the maximum $x$ value.

For instance, if you want $N=150$ you set $$f(x)=\frac{4 x}{3}-\frac{x^2}{225}$$ and get a curve like the following

enter image description here

Raffaele
  • 26,371