Re: Re: Re: Just another bug in MMA 3.0
- To: mathgroup at smc.vnet.net
- Subject: [mg7591] Re: [mg7532] Re: [mg7491] Re: [mg7431] Just another bug in MMA 3.0
- From: Richard Finley <trfin at fiona.umsmed.edu>
- Date: Thu, 19 Jun 1997 03:13:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
This is the way I see it.... if you want to do multiple sums you use the standard form in the Mma documentation...it seems to work fine. If you use the nonstandard approach of actually nesting sums, then IF the inner sum is evaluated, it will see any included dummy variables in the outer sum and you will get what you want (which is why it worked with the function f (j ) = j which is able to be summed exactly for an indeterminate n) and it also works for numerical limits. If the inner sum canNOT be evaluated and is left in the form Sum[ something ], then the outer sum will not see any variables in the inner sum and you frequently will not get what you intended as your example shows. This is due to Sum having the HoldAll attribute. I don't think it is really fair to call it a BUG because there may be a reason that Sum has the HoldAll attribute. If you want nested sums to work the same as multiple sums, you can simply remove the HoldAll attribute using ClearAttributes[ Sum, HoldAll ] and you get the result you are looking for. RF At 03:08 AM 6/13/97 -0400, Kai Koehler wrote: >In article <5nfpv3$5qp at smc.vnet.net>, Paulo Mouat <mouat at mail.telepac.pt> wrote: > >> Kai Koehler wrote: > >> > Sum[Sum[Log[Log[k+j]],{k,1,n}],{j,1,5}] >> > >> > gives >> > >> > 5*Sum[Log[Log[k + j]], {k, 1, n}]. > >> If you want to do a multiple sum, the input should read >> >> Sum[Log[Log[k+j]],{k,1,n},{j,1,5}] >> >> What you have typed is a simple sum over k with a function that has an >> unknown j. The j on the outer Sum is a dummy variable, with no >> relation to the one in Log[k+j]. >> >> This is not a bug. Mathematica simply interpreted what you did type, >> which is not quite what you intended to do. > >If this where true, > >Sum[Sum[j,{k,1,n}],{j,1,5}] > >should give 5 n j as output. Instead you get 15 n (correctly, IMHO). >Also, in StandardForm, the difference between > >Sum[Sum[Log[Log[k+j]],{k,1,n}],{j,1,5}] > >and > >Sum[Log[Log[k+j]],{k,1,n},{j,1,5}] > >is just the insertion of a factor (e.g. 1) between the two sums: > >\!\(\+\(j = 1\)\%5 1 \(\+\(k = 1\)\%n Log[Log[k + j]]\)\) > >gives a different output then > >\!\(\+\(j = 1\)\%5\(\+\(k = 1\)\%n Log[Log[k + j]]\)\) > >Similarly, > >\!\(\+\(j = 1\)\%5\((\ \+\(k = 1\)\%n Log[Log[k + j]])\)\) > >gives a different output then > >\!\(\+\(j = 1\)\%5\((\ \+\(k = 1\)\%n Log[Log[k + j]] + 1)\)\) > >What you wrote is actually what Michael Trott from Wolfram support mailed >me 2 days ago: It's not a bug, it's a feature. This really worries me: If >they do not even recognize a bug when you show it to them, then what can >you expect them to do? > >Kai Koehler > >