Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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:

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

My basic formula is:

boost = importance / ((radius + distance) ** dropoff)
For instance, an importance of 100, a dropoff of 0.5 and a radius of 0 gives me a curve like:
16 : @@@@@@@@@@@@@@@@@@@@@@@@@ 32 : @@@@@@@@@@@@@@@@@ 64 : @@@@@@@@@@@@ 128 : @@@@@@@@ 256 : @@@@@@ 512 : @@@@ 1024 : @@@ 2048 : @@ 4096 : @ 8192 : @
But with a 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


In reply to [OT] Normalizing the return result of an exponential formula by clinton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (5)
    As of 2015-07-04 10:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (59 votes), past polls