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.

Hrmmm, I can't help much unfortunately, but it would be logarithmic regression.  I've worked with linear and quadratic regression before, but never logarithmic.  I would imagine it would be similar math behind them, but I can't remember exactly how it works.

No problem.  Hope ya figure it out or someone can come along and tell ya exactly what you're looking for.  If only I knew more calculus :(.  (Actually this would probably be borderline calculus and more algebra, but oh well.)

another regression to look up might be exponential, using a negative exponent and whatever base fits the best.  just another option.  don't forget that you can always change the base of a logarithm by using the base-change formula.

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).

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.