# Base of logarithm decrease when variable count increase

I run a large online platform where users submit articles and earn points. I am working on an algorithm where the more comments they submit, the higher score they will receive.

In its simplest stripped down form, this is how the algorithm looks like (the variables are the user's count for each contribution):

( $total_articles * log($total_articles_featured , 1.$total_comments) ) = Score  My aim with the algorithm is to make it valuable to have a high $total_comments count. And I need the $total_comments count be added to the base of the logarithm. So, with the above calculation, if the user has 350 comments, then the log base will be 1.350. The obvious problem is that with this calculation, the more comments the user has, the lower score they will receive. I need this to be the opposite. So that the log base decimals decreases whenever the user's $total_comments count increases. And the value should never be 0 (because that will set the logarithm into infinity).

How would I solve this?

When answering, if you are using calculations beyond basic maths, kindly make a note of what each function is called.

• If we let $c$ be the number of comments, you want to have the log base to be a function $f(c)$ which is decreasing and is always greater than 1, so you could try some examples such as $f(c)=1+\frac{1}{c}$ or $f(c)=1+\frac{1}{c^2}$ or $f(c)=1+e^{-c}$ to see which function gives you results similar to what you want. – user84413 Aug 26 '14 at 17:24
• @user84413 I tried 1 + (1/C) but the results were not ideal. For example, if C is 2, then the results would be 1.5 - If C is 6, then results are 1.17 - it is way to big jump. Ideally, I want the the results to reach 1.17 once C is above 1000... – Gary Woods Aug 27 '14 at 13:46
• I suggest using a linear method for something like x from 1 to 1000 and then switching to a function like $1+1/\log(ax)$ – Alice Ryhl Aug 27 '14 at 15:05
• @Darksonn Can you please explain this in further detail? Note that my math knowledge is limit nowadays. How would I keep x between 1-1000 and what does the ax stand for in log? – Gary Woods Aug 27 '14 at 15:44
• @GaryWoods My function was to have the function be a decreasing line from 0 to 1000, but when you reach thousand you make the function flatten out so you never actually go down to 1. A simpler solution would be to say 1/$total_comments instead of 1.$total_comments in the base of the logarithm – Alice Ryhl Aug 27 '14 at 15:48

In your formula you wrote $a\cdot\log_{1.c}b$. In the plots, I'm plotting the function which would go in the base of the logarithm. So the function we want is a function which is always above 1 and is decreasing towards 1

$$a\log_{1.c}b=\frac{a\log b}{\log 1.c}$$

This was what you suggested in your question, and I don't think this is what you wanted Now if we replace the base with

$$1+\exp (-c/55)$$

We get this By increasing $55$ you can make this curve flatten even slower. Here the function is with $550$ instead of $55$ (notice the numbers at the bottom) I think the function you would want is this:

$total_articles * log($total_articles_featured , 1 + exp(-$total_comments/550.))  However you could change the constant 550. to change the rate of flattening. Edit: Alternative solution In the comments you expressed interest in a solution with a straight line which then flattens, I will explain how it works here. The difference between the solutions is that with this solution, comments loser their value slower at the start, but later they lose their value faster then the previous solution. Actually what I suggested is very simple, the function has two different formulas in the area 1 to say 1000 comments and a different formula above 1000 comments. Here's finding a simple function like this: The first task is finding a linear equation which goes from 2 to$1+\exp(-1000/550)=1.162320611...$The equation for a linear function is $$ax+b$$ And$b$is the value of the function at$0$, and since we want it to start at$2$,$b$will be$2$. The next we need to find is$a$and we can do this because we want the value of the function at$1000$to be$1+\exp(-1000/550)=1.162320611...$$$1000a+2=1.162320611...$$ Which when solved is $$a = -0.000837679$$ This linear equation looks like this: The line looks great in the start but we reach problems somewhere since the function goes below$1$and we don't want that. There is a solution, we make a piecewise function. $$f(x)=\left\{ \begin{array}{lr} -0.000837679x+2&\quad \text{if }x<1000\\ 1+\exp (-c/550) &\text{if }x\ge 1000 \end{array} \right.$$ Which gives us: And that function will never reach$1$. If you want to use the function above this would be the code $total_articles * log($total_articles_featured,$total_comments < 1000 ? 2-$total_comments/1193.7747 : 1 + exp(-$total_comments/550.))


We might want this function to have a less abrupt cut in it, and we can decrease the cut by increasing the point where we switch from line to flattening formula. However we will never remove the cut completely.
I think the other solution is better because when we get to a point where we almost cant see the cut anymore, the linear function decreases so slowly that the amount of points each comment gives is almost the same unless you post a truly great amount of comments.

• I have noticed that some outstanding answers don't get enough recognition on this platform. Therefore, I have set this on a 50 point bounty which you will receive because this answer is great, mainly because you saw the flaw in my initial calculation and provided me with an excellent solution, and included graphs which are more useful than I can express. Thank you very much indeed. (the bounty will be awarded in 24 hours) – Gary Woods Aug 28 '14 at 15:53
• @GaryWoods Thank you very much. – Alice Ryhl Aug 28 '14 at 15:59
• Ah, I only saw this edit today. You should know that question author does not receive a notification whenever there is an edit to an answer. Darksonn, this is absolutely lovely. We will implement both versions of the algorithm and run it to 1000 users each and see how well it converts. Then we will make the final call on which is better. Nonetheless, thank you very much again for your hard work! – Gary Woods Sep 1 '14 at 13:22
• No problem, glad to help – Alice Ryhl Sep 1 '14 at 13:26