Jump to content

Construct log-like function to pass through 3 specific points


btherl

Recommended Posts

Let's say I have the following specification:

 

f(100000) = 5

f(50000) = 200

f(1) = 1000000

 

Those are 3 points I've specified.  I want a function f() which is a smooth, log-like curve that passes exactly (or really really close) through those points.  Is there a method I can use to construct this function such that the final function can be implemented in php?

 

The method of constructing does not need to be in php, just the function f() itself.

Link to comment
Share on other sites

This particular data is from a friend of mine who wants to assign dollar values to rankings.  Rank 1 is worth $1,000,000, rank 100,000 is worth $5, and rank 50,000 is worth $200.

 

But the general problem is one that I often want to solve for making heuristics that take rankings and various other data as input, and produce a score as output.  For example, I may want to convert a keyword search count to a linear scale from 0 to 10, but I want the conversion to be log-like.  Then I might want a function like:

 

Search Count => Score

1,000,000 or more => 10

100,000 => 5

10,000 => 3

1,000 => 2

100 => 1

10 or less => 0

 

So the shape looks logarithmic, but a simple logarithm will never match all those points (though it might get close enough).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.