

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

I have the following formula which represents the cost $s$ of an action on a particular day:

$s = (c\sum\limits_{n=1}^l n)^{d/l}$

I want to choose $l$, so that $s$ is minimised, given a particular $c$ and $d$.

* I will want to do the action many times per day.
* On any particular day, $d$ is given, but it may be different on different days.
* $c$ is also given, but may be different each time I do the action.
* For $l$, I can choose any integer between $1$ and $d$ (inclusive).
* $d$ will be an integer. Realistic values are around $100$ to $10000$, although higher and lower are possible. It will always be at least $1$, if that matters.
* $c$ will be a positive number (greater than $0$).

How do I determine the value for $l$ that results in the lowest possible $s$, given $c$ and $d$?

share|cite|improve this question
I come from a software development background, so if anything is ambiguous or poorly expressed, please assume I mean it as a programmer would. – everybody Dec 8 '12 at 12:10
is c a function of n – Amr Dec 8 '12 at 12:12
If c is a constant why don't you put it outside of the sum? – Amr Dec 8 '12 at 12:13
c is a constant and has now been moved outside the sum. – everybody Dec 8 '12 at 12:17
up vote 1 down vote accepted

I'll write $L$ instead of $l$ for easier readability.

Here is a partial solution that assumes that the optimal $L$ will be fairly large. The sum can then be written as $$ s(c,d,L) = (cL^2)^{d/L} \left(\sum_{j=1}^L \frac{j}{L^2} \right)^{d/L} \approx (cL^2)^{d/L} \left(\frac{1}{2} \right)^{d/L} = \left(\frac{cL^2}{2} \right)^{d/L} $$ since $\sum_{j=1}^L \frac{j}{L^2} \approx \int_0^1 x dx = 1/2$ for large $L$.

Take logarithms to get $$ \log s \approx (\log c + 2 \log L - \log 2) \frac{d}{L} \, . $$ The derivative with respect to $L$ is $$ \frac{\partial }{\partial L} \log s = \frac{d(2 - \log c - 2 \log L + \log 2)}{L^2} = \frac{d}{L^2}\left(\log (2e^2/(cL^2) \right) $$ and this is positive if $cL^2 < 2e^2$ and negative for larger $L$. Therefore $s$ is minimal when $L$ is as large as possible, i.e. $L = d$, resulting in the value $s \approx cd^2/2$.

This should now be compared against small values of $L$ ($L \le 10$ or so), which can be done by direct computation.

share|cite|improve this answer
Thanks, Hans! If I wanted to learn more about this, can you provide some useful links or even pertinent search phrases? – everybody Dec 20 '12 at 13:08
This solution was essentially made up on the spot. – Hans Engler Dec 20 '12 at 22:27

Your Answer


