How can I help SumConvergence give the right result?
The culprit is Sum`SumConvergenceDump`UnivariateLogarithm[]
, 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.
Internal`InheritedBlock[{Sum`SumConvergenceDump`UnivariateLogarithm},
DownValues[Sum`SumConvergenceDump`UnivariateLogarithm] = Prepend[
DownValues[Sum`SumConvergenceDump`UnivariateLogarithm],
(* new def. for UnivariateLogarithm[] *)
HoldPattern[
Sum`SumConvergenceDump`UnivariateLogarithm[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 = Sum`SumConvergenceDump`UnivariateLogarithm[
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 *)