# How can I help SumConvergence give the right result?

I've been trying to use the SumConvergence on the following series:

SumConvergence[1/(n Log[n] Log[n Log[n]]), n]


This returns False on Mathematica 11.3, but I suspect this is incorrect since:

$$\frac{1}{n \log(n) \log(n \log(n))} < \frac{1}{n \log(n) \log(n)}$$

attempting to check the convergence of the RHS

SumConvergence[1/(n Log[n] Log[n]), n]


returns True. So by direct comparison, the initial series should converge. I've also plotted the two functions to further justify the argument. What can I do to help SumConvergence recognize that the initial series converges?

• Mathematica seems to like the comparison tests less than calc. students: Reduce[n > 1 && 1/(n Log[n] Log[n Log[n]]) < 1/(n Log[n] Log[Log[n]]), n, Integers] and Limit[(n Log[n]^y)/(n Log[n] Log[n Log[n]]), n -> Infinity, Assumptions -> 1 < y < 1 + 1/10^6] show convergence, but I don't know how to teach SumConvergence the comparison methods. Jul 30, 2019 at 14:15

The culprit is SumSumConvergenceDumpUnivariateLogarithm[], which mistakenly decides the sum is not convergent. It should be reported as a bug. (It would be acceptable if it couldn't decide, but to reach the wrong conclusion is wrong.)

Here's a modest implementation of the limit comparison test within the log-testing code. It uses the Villegas-Gayley trick to insert the code ahead of the built-in UnivariateLogarithm[] codes. We need to manually insert it as the first code in the DownValues, so that it is called before other definitions of UnivariateLogarithm[]. Since UnivariateLogarithm[] is buggy, it's a question whether I should call it (or SumConvergence[], which in turn would call it) after the comparison test to check convergence of the transformed series. I probably shouldn't unless I can prove I've avoided the bug, but just how much work should I do rooting around undocumented functions for free? Better to let WRI decide how to fix their software.

InternalInheritedBlock[{SumSumConvergenceDumpUnivariateLogarithm},

DownValues[SumSumConvergenceDumpUnivariateLogarithm] = Prepend[
DownValues[SumSumConvergenceDumpUnivariateLogarithm],
(* new def. for UnivariateLogarithm[] *)
HoldPattern[
SumSumConvergenceDumpUnivariateLogarithm[expr_, k_] /;
! TrueQ[$$inLimitComparisionTestQ] && ! FreeQ[expr, _Log] ] :> Block[{$$inLimitComparisionTestQ = True},
Module[{factors, comparisons, log, nlogs, res},
factors = Rest@FactorList[expr];
nlogs = Max[Count[#, _Log, Infinity, Heads -> True] & /@
factors[[All, 1]]];
factors = Power @@@ factors;
log = k; (* log is the iterated composition of Log[]
with k up to nlogs number of times *)
While[Depth[log] <= nlogs + 1 && ! TrueQ@res,
comparisons = Abs@Limit[log*factors, n -> Infinity];
res = SumSumConvergenceDumpUnivariateLogarithm[
Times @@ ReplacePart[
factors,
Position[comparisons, L_ /; 0 < L < Infinity] -> 1/log],
k];
log = Log@log
];
res /; TrueQ@res
]
]
];

SumConvergence[1/(n Log[n] Log[n Log[n]]), n]
]

(*  True  *)

• It would be useful if Method->"IntegralTest" uses the numeric integration in some cases. Jul 30, 2019 at 16:25
• @user64494 One can use NSum[1/(n Log[n] Log[n Log[n]]), {n, 2, Infinity}], if one wants an approximate verification of convergence via NIntegrate. One can try to substitute NIntegrate for Integrate for SumConvergence, but I think it will almost always return True since NIntegrate almost always returns a numeric result: Block[{Integrate = NIntegrate}, SumConvergence[1/n, n, Method -> "IntegralTest"]]. Jul 30, 2019 at 18:05
• Many thanks from me to you for your comprehensive analysis of my suggestion. There is a room to improve NIntegrate for divergent improper integrals. Jul 30, 2019 at 18:34
• Compare NIntegrate[1/x, {x, 1, Infinity}] which results 191612. with the command of Maple int(1/x, x = 1 .. infinity, numeric) which performs Float(infinity). Jul 30, 2019 at 18:56

This can be done in two steps.

1. ForAll[n, n >= 2, D[1/(n Log[n] Log[n Log[n]]), n] <= 0];Resolve[%, Reals] *True*

2. NIntegrate[1/(n Log[n] Log[n Log[n]]), {n, 2, Infinity}] *1.42474*`