1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Sum of log squared terms?

  1. Aug 10, 2012 #1
    Hi all,

    I have a summation series which goes like this,

    S = [log(1)]^2 + [log(2)]^2 + [log(3)]^2 + ....... + [log(n)]^2

    Since each term is square of the logarithm of a value, I think there are no general tricks which can be used to solve this.

    But is there any way to approximate the value of this summation?

    The problem I am facing here is that n is very very large and it is not possible (time-wise and memory-wise) for my program to evaluate every term. So I was hoping for some approximate solution in terms of 'n'.

  2. jcsd
  3. Aug 10, 2012 #2
    Well, we know that since [itex]f(x)=(log(x))^2[/itex] is increasing (if x>1)

    [tex]\int_2^{n+1} \log(x-1)^2dx \leq \sum_{n=1}^n \log(n)^2 \leq \int_1^{n+1} \log(x)^2 dx[/tex]

    So, if you calculate the integral, then you got a sweet upper and lower bound for the sum.
  4. Aug 11, 2012 #3


    User Avatar
    Gold Member

    can't this be a manipulated into a product of n? log(2)+log(3) = log((2)(3)), I'm uncertain what to do with the squared.
  5. Aug 11, 2012 #4
    Not really. But the integral

    [tex]\int \log(x)^2dx[/tex]

    has a nice elementary solution. Just integrate by parts twice.
  6. Aug 11, 2012 #5


    User Avatar
    Homework Helper

    In a similar vein, there is also the Euler-Maclaurin formula for asymptotic expansions of sums.

    [tex]\sum_{k=a}^{k=n} f(k) \sim \int_a^n dx~f(x) + \frac{f(a)+f(n)}{2} + \mbox{corrections}.[/tex]

    (The full form of the expansion is given on the wikipedia page I linked to). This looks like it would be useful in this case.
  7. Aug 11, 2012 #6
    Thanks for your help guys. Appreciate it.

    @micromass: I am not so good at Math. I was wondering how tight these bounds are?

  8. Aug 15, 2012 #7
    You would have to calculate the integral to find out. Or you can let an online calculator do it. To find the tightness of the bonds, calculate the difference between the integrals, or in other words the integral from n to n+1.


    Using Wolfram Alpha the integral from 10 to 11 for example is ~5.5, so if you take the average of them you get a maximal error of ~2.75, actual error would probably be much less, since the function doesn't jump too much, and is rather straight for intervals of width 1. Lower bound is ~25, and using Wolfram Alpha to calculate the sum directly gives ~27.65. If you want more accuracy, you could calculate a few terms of the sum directly, and then get the upper and lower bounds for the rest, for the upper bound it is the sum from 1 to m-1 plus the integral from m to n+1, and for the lower bound the sum from 1 to m-1 plus the integral from m-1 to n. The difference of the upper and lower bounds now turns out to be the integral from n to n+1 minus the integral from m-1 to m, which is better than just the integral from n to n+1.

    So for example if you want the sum of the first 1000 terms and you know the first 100 terms exactly, you could do something like this. Sum of first 100 terms is 1408.33. Lower bound is 1408.33+34501.8=35910.13, higher bound is 1408.33+34528.3=35936.63, average is 35923.38. Letting Wolfram Alpha calculate the sum itself, it gets the answer 35923.4, I don't know how it calculates the sum itself and how much it rounded that answer, but at least it shows that taking the average of the bounds is not too bad. So now you have an approximation of the sum of the first 1000 terms, you can now use that to calculate the sum of the first 10000 terms etc.
  9. Aug 16, 2012 #8
    I also tried the Euler-Maclaurin formula. Adding only first two terms from the sum with the Bernoulli numbers in it, it got the sum of the first 1000 terms of log(x)^2 accurate to within 0.0015, so it seems a lot better than just taking the average of integral bounds, especially if you would include more of the correction terms. You could probably get very accurate with more correction terms.
  10. Aug 16, 2012 #9
    @chingel, @mute: Thanks for all the help. I am using Euler-Maclaurin formula now, seems to work really well for me. I actually have an upcoming deadline, and now I am good! :)

    Thanks all.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook