Is there any way top make this integral less oscillatory?

Quiet@Re[NIntegrate[Log[n Log[n Log[n]]] – 1/(Log[n Log[n Log[n]]]),

{n, 2, #}]] & /@ Range[2, 100] // ListLinePlot

=================

4

One way to improve on the error estimates is to incrementally integrate over each successive pair of integers. Then sum the partial results. Quiet[vals = NIntegrate[ PowerExpand[Log[n Log[n Log[n]]] – 1/(Log[n Log[n Log[n]]]), Assumptions -> n > 2], {n, #, # + 1}] & /@ Range[2, 100];] sums=Accumulate[vals]. Now use sums in that plot.

– Daniel Lichtblau

May 14 ’15 at 21:10

@DanielLichtblau that is great – looks perfect – thank you 🙂

– martin

May 14 ’15 at 21:16

@DanielLichtblau – could you please write this up as an answer?

– Verbeia♦

May 15 ’15 at 5:33

=================

2 Answers

2

=================

The problem actually seems to be caused by the very first pair of integers – (2,3)

This is because there is actually a singularity in the function here:

Plot[Log[n Log[n Log[n]]]-1/Log[n Log[n Log[n]]],{n,2,3}]

If we ask Integrate to symbolically evaluate the integral between these bounds, it tells us that is does not converge:

Integrate[Log[n Log[n Log[n]]]-1/Log[n Log[n Log[n]]],{n, 2, 3}]

Integrate::idiv: Integral of -(1/Log[n Log[n Log[n]]])+Log[n Log[n Log[n]]] does not converge on {2,3}. >>

The rest of the function is smooth so if we perform the entire calculation but starting at 3 rather than 2, we encounter no issues:

ListLinePlot[NIntegrate[Log[n Log[n Log[n]]]-1/Log[n Log[n Log[n]]],{n,3,#}]&/@Range[3, 100]]

And the result is smooth:

Good point, which I managed to miss.

– Daniel Lichtblau

May 15 ’15 at 19:05

@Nick I feel a little bit silly that I missed this too! Thanks for the great answer! 🙂

– martin

May 15 ’15 at 20:21

Don’t forget that the answer can be accepted..

– Daniel Lichtblau

May 16 ’15 at 22:29

One way to improve on the error estimates is to incrementally integrate over each successive pair of integers. Then sum the partial results.

Quiet[vals = NIntegrate[ PowerExpand[Log[n Log[n Log[n]]] –

1/(Log[n Log[n Log[n]]]), Assumptions -> n > 2], {n, #, # + 1}] & /@

Range[2, 100];]

sums = Accumulate[vals]

Now use sums in that plot.

ListLinePlot[Accumulate[vals]]

I do not know offhand why the error estimates as originally posed are so jittery. I’ll ask around if I get a chance.

this is a great technique – thanks for posting as an answer 🙂

– martin

May 15 ’15 at 20:20