Re: how to make Sum[n,{n,1,5}] to print 1+2+3+4+5? HoldForm?
- To: mathgroup at smc.vnet.net
- Subject: [mg79425] Re: how to make Sum[n,{n,1,5}] to print 1+2+3+4+5? HoldForm?
- From: dimitris <dimmechan at yahoo.com>
- Date: Thu, 26 Jul 2007 05:37:59 -0400 (EDT)
- References: <f86qdq$o7p$1@smc.vnet.net>
On 25 , 09:26, Nasser Abbasi <n... at 12000.org> wrote: > hi, I am using version 6 > > what is the trick to make Sum[] just print the terms first, before > adding them? Say I want to do > > r= Sum[n,{n,1,5}] > > But I want to see 1+2+3+4+5, i.e. the terms printed out before they > are actually added. > > then later I can do Evaluate[r] or N[r] something like this to get it > to actually do the sum. > > I tried the different Hold commands, but non seems to do it. > > thanks, > Nasser The simplest thing is In[4]:= Sum[(HoldForm[#1] & )[i], {i, 1, 5}] ReleaseHold[%] Out[4]= 1+2+3+4+5 Out[5]= 15 But what is more elegant is (at least for me) to write the sum as 1+2+3+4+5+... and do all the things you can encounter in any textbook like summation/multiplication etc with another similar expression. I think that David Park is working with this issue. Regards Dimitris