Check this:
NSum[Log[Abs[m]],{m,1,24}]
(*54.7847*)
NSum[Log[Abs[m]],{m,1,25}]
NSum::nsnum: Summand (or its derivative) (Abs^[Prime])[m]/Abs[m] is not numerical at point m = 16. >>
I know that I can get around this issue by replacing NSum
to N@Sum
or even drop Abs
. Yet I really want to know where is the (Abs^\[Prime])[m]
comming from?
I haven't check this on all platforms, but at least this happens to v10.1
(both Windows and Linux)& v10.2(Windows)
even in v7(Windows)
. I must say I'm really shocked by such a stupid bug.
Answer
Might it have something to with the option NSumTerms
? From the documentation:
NSumTerms
is the number of terms to use before extrapolation.By default NSum uses 15 terms at the beginning before approximating the tail.
Thus trying it with just 16 terms instead of the default removes the error message.
NSum[Log[Abs[m]], {m, 1, 25}, NSumTerms -> 16]
(* 58.0036 *)
(* For verification *)
N@Sum[Log[Abs[m]], {m, 1, 25}]
(* 58.0036 *)
Comments
Post a Comment