开发者

Simple math question: [closed]

Closed. Th开发者_JS百科is question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 12 years ago.

Improve this question

I have a simple question.

I have two values MIN and MAX. Then i have a series of values (X) that can be between 0 and +infinity.

Now I want to have an algorithm that maps each value x of X into the range between MIN and MAX.


Here's one that just uses basic arithmetic (no atan or exp):

MAX + (MIN − MAX) / (1 + x)

If you need to vary the shape of this conformal mapping, try

MAX + (MIN − MAX) / (1 + f(x))

for any positive function f (for example f(x) = kx or f(x) = √x or ...).


MIN + atan(x)*(MAX-MIN)/(PI/2)


Assuming you want a monotonically increasing function:

MAX + (MIN - MAX)*exp(-k*x)

Where k is a rate factor that determines how quickly the mapping approaches MAX.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜