Formula to reduce higher numbers

Honestly, I can’t figure out what to look for, but what I tried did not give any results, so I apologize if it is already asked.

This is also a more mathematical question than a programming question, but I do it in JavaScript, and it seemed pretty suitable.

What I want to do is reduce the number, the higher. For example, 10 can be reduced to 9, and 100 can be reduced to 20. I tried using the number and division itself, but obviously this just returns a fixed number. I also tried simple separation, but all of this reduced the amount too much and had little effect on higher numbers in comparison. Is there any formula for this using a JavaScript Math object?

+3
source share
3 answers

From the two examples you gave you can look for the decyclone scale:

function reduce(x) {
    return 10 * Math.log(x) / Math.LN10 ;
}

For your examples

reduce(100) = 20
reduce(10)  = 10
+4
source

A few math functions that may be useful are

  • Square root (or any root in general)
  • Log function (to a database that does the work for your scaling needs)

Combine them with multiplying the result or input by a constant and / or adding a value to the result or input, and you can find many scaling options.

You may even consider combining these functions.

A quick way to see how the function by which you decide will scale the numbers is to enter them in a graphing calculator (or wolframalpha.com) and see the graph for the various inputs.

+1
source

, Wolfram Alpha:

http://www.wolframalpha.com/input/?i=best+fit+ [10% 2C + 9]% 2C + [100% 2C + 20]

+1
source

All Articles