Student Support Forum: 'bug in Series[] function' topicStudent Support Forum > General > "bug in Series[] function"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response Forum Moderator email me 06/10/13 2:11pm In Response To 'Re: Re: Re: bug in Series[] function'---------Nope. Even deeper. With the original definition for g, g with an undefined symbolic argument returns the argument. In[6]:= g[n] Out[6]= n When the infinite Sum sees this, it becomes, Sum[z^n*4*3^(n - 1), {n, 1, Infinity}] === Workaround: Define g so it works only for numerical arguments and use NSum. In[8]:= Clear[g] In[9]:= g[n_Integer] := Sum[f[k], {k, 1, n}] Now with undefined symbolic argument, g[ ..] returns the whole function call. This will give g another chance later if the output is used. In[10]:= g[n] Out[10]= g[n] In[11]:= NSum[(2/10)^g[n]*4*3^(n - 1), {n, 1, Infinity}, WorkingPrecision -> 25] Out[11]= 0.9158917783243623531876077 In[12]:= NSum[(2/10)^g[n]*4*3^(n - 1), {n, 1, 100}, WorkingPrecision -> 25] Out[12]= 0.9158917783243623531876077 URL: ,

 Subject (listing for 'bug in Series[] function') Author Date Posted bug in Series[] function Eric Freden 06/03/13 2:31pm Re: bug in Series[] function yehuda 06/06/13 09:50am Re: Re: bug in Series[] function Eric Freden 06/06/13 11:44am Re: Re: Re: bug in Series[] function Forum Modera... 06/07/13 4:59pm Re: Re: Re: Re: bug in Series[] function Forum Modera... 06/10/13 2:11pm Re: Re: Re: bug in Series[] function yehuda 06/08/13 2:22pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic