MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: New version, new bugs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43205] Re: New version, new bugs
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 20 Aug 2003 22:24:50 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <bgq9q4$d50$1@smc.vnet.net> <bhaah2$kt6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <bhaah2$kt6$1 at smc.vnet.net>, Maxim <dontsendhere@.> wrote:

> 1) when writing out sums of rising factorials:
> 
> In[1]:=
> Module[
>   {c = Pochhammer[-2, -1 + k]},
>   Sum[c,{k,1,Infinity}]
> ]
> 
> Out[1]=
> Infinity*Pochhammer[-2, -1 + k]
> 
> in version 4.2 this sum is left unevaluated -- hardly an improvement;

Because Sum does not evaluate its arguments (it is HoldAll), Evaluate is 
required:

  Module[
    {c = Pochhammer[-2, -1 + k]},
     Sum[Evaluate[c],{k,1,Infinity}]
  ]

You can avoid such a convoluted construct by writing

  Sum[Pochhammer[-2, k - 1], {k, 1, Infinity}]

> 3) at first I was scanning the lists of coefficients in a more procedural
> way, and noticed a strange behaviour or Increment; here's an example to
> demonstrate it more clearly:
> 
> In[1]:=
> Compile[
>     {},
>     Module[
>       {L={10,20,30},a=1},
>       L[[a++]]++;
>       Append[L,a]
>       ]
>     ][]
> 
> Out[1]=
> {10,31,30,4}
> 
> Imagine using a C compiler with this sort of glitches. Once again the bug
> appears in a function that doesn't have a precise definition; all this
> certainly would have been of little importance for an educational software,
> but not for a serious development tool.

Perhaps a previous posting to this group (in 1999),

http://groups.google.com/groups?q=%2B%2B+withoff+increment&hl=en&lr=&ie=U
TF-8&selm=7n68mn%24gu3%40smc.vnet.net&rnum=2

explains your problem here?

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Problem mit DSolve
  • Next by Date: Imported Plot =!= Exported Plot
  • Previous by thread: Re: New version, new bugs
  • Next by thread: Re: New version, new bugs