Re: Strange behavior of NSum on 4.0
- To: mathgroup at smc.vnet.net
- Subject: [mg28080] Re: Strange behavior of NSum on 4.0
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 30 Mar 2001 04:12:30 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <99uruh$5vv@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, a) Plus @@ a wil compute the sum b) NSum[] uses the first few terms to approximate a large sequence of terms by an extrapolation algorithm. and I expect that 25 terms are the boundary when NSum[] switch from native summation to the extrapolation Regards Jens Ken Kikuchi wrote: > > I encountered a strange behavior with NSum on Mathematica 4.0 on Mac. > The following is a simplified example about sum of 1 to 25. > > In[1]:= a = Range[25] > Out[1]= > {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, > 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25} > > In[2]:= NSum[a[[i]], {i, 25}] > > I expected the result as 325 but received the following strange error > messages. > > Part::pspec : > Part specification 41/2 is neither an integer nor a list of > integers. > ... > NIntegrate::inum : > Integrand <<1>>[[41/2]] is not numerical at {1}={41/2}." > > However, the same code works fine up to 24. > In[23]:= NSum[a[[i]], {i, 24}] > Out[23]= 300. > > It works fine if not using Part. > In[3]:= NSum[i, {i, 25}] > Out[3]= 325. > > But Part works fine with N while manual noted -- N[Sum[...]] calls NSum. > In[4]:= N[Sum[a[[i]], {i, 25}]] > Out[4]= 325. > > And Sum works too. > In[5]:= Sum[a[[i]], {i, 25}] > Out[5]= 325 > > My version is, > In[6]:= $Version > Out[6]= "4.0 for Power Macintosh (July 26, 1999)" > > I am not sure it's only my environmental problem or my incorrect usage. > Could anyone help me? > > Many thanks, > Ken