*clinton has asked for the wisdom of the Perl Monks concerning the following question:*

I'm trying to come up with a formula that I can use to represent distance from a central point, and will return a `boost` value in a range, eg 0..10.

This formula can accept two (or maybe 3) variables:

`importance`: this controls the upper limit of the range, eg 0..10, 0..100`radius`: ie any distance within this inner radius should be pretty much as important as any other point within this radius`dropoff`: (optional) how quickly the`boost`should drop off as distance increases

My basic formula is:

For instance, anboost = importance / ((radius + distance) ** dropoff)

`importance`of

`100`, a

`dropoff`of

`0.5`and a

`radius`of

`0`gives me a curve like:

But with a16 : @@@@@@@@@@@@@@@@@@@@@@@@@ 32 : @@@@@@@@@@@@@@@@@ 64 : @@@@@@@@@@@@ 128 : @@@@@@@@ 256 : @@@@@@ 512 : @@@@ 1024 : @@@ 2048 : @@ 4096 : @ 8192 : @

`radius`of

`1000`, I get a much smaller range:

16 : @@@ 32 : @@@ 64 : @@@ 128 : @@ 256 : @@ 512 : @@ 1024 : @@ 2048 : @ 4096 : @ 8192 : @

I would like to change the formula to make the upper limit of the range dependent only on `importance` and not on `radius`. For the life of me I can't figure out how to do that.

**PS:** `distance` can be considered to have an upper limit of, eg, `10,000km` if that helps

**PPS:** As an optional extra, it would be nice to be able to configure the rate of `dropoff` without affecting the upper limit of the range, but I can live without it

Back to
Seekers of Perl Wisdom

Comment on[OT] Normalizing the return result of an exponential formulaSelectorDownloadCode