Non-Linear function for a range

149 Views Asked by At

I have a range and I want to convert it to a range using a non-linear function. My range is from $[100,1000000]$ and I want a non linear function so that this range converts to $[1,100]$ in non-linear way. I tried $y=100000/x$ and then linear transform it to $1-100$ range. But this method gives a very sharp gradient, eg

100-1000
200-500
300-333
400-250
...
10000-10
100000-1
1000000-1

I want something which gradually changes but still non-linear and not so steep. Is their any better way to solve this problem?

2

There are 2 best solutions below

0
On BEST ANSWER

One possibility is applying $\sqrt{x}/10; \sqrt{100}/10=10; \sqrt{1,000,000}/10=1000$?

0
On

Choose any non-linear function $f:A\to B$ such that $[10^2,10^6]\subset A$ and that $f([10^2,10^6])\subset [1,100]$.

Many polynomials fit this criteria, and you can use the Lagrange interpolation polynomials to fit your needs.

Some logarithmic and exponential functions (by example something with the form $ae^{1/x}+c$) can fit also this criteria.

Same for many rational functions or power functions like $ax^p+\ldots$. Same for trigonometric functions, by example $a\sin x$, etc... but in this case the function is not injective.

An example is fitting the arc of a circumference

$$r^2=(x-a)^2+(y-b)^2\implies \begin{matrix}f(x)=\sqrt{r^2-(x-a)^2}+b\\\text{ or }\\f(x)=-\sqrt{r^2-(x-a)^2}+b\end{matrix}$$

for a circumference centered in $(a,b)$. Then you can define a function setting the center $(a,b)$ in some point on the bisection of the segment defined by the points $(10^2,1)$ and $(10^6,100)$.

As you can see there are infinite solutions. The solution chosen depends on your criteria about what kind of shape of the curve you want.


The general procedure is: choose some continuous function $f$ with undefined parameters and choose it parameters such that the equations

$$f(10^2)=1,\quad\text{and}\quad f(10^6)=100$$

holds.