[R] Infinite Series

Don McKenzie dmck at u.washington.edu
Sat Jul 25 01:48:39 CEST 2015


cumsum(1/(1:100)^2)[100]


> On Jul 24, 2015, at 4:37 PM, Janh Anni <annijanh at gmail.com> wrote:
> 
> Hello Jeff,
> 
> Thanks a lot.  I tried it and see that it prints out the entire 100 partial
> sums, so I can take the last value as the partial sum for the first 100
> terms. Would there be any way cumsum can print only the nth partial sum,
> i.e. the last value in the array, instead of printing the entire array?
> Thanks again.
> 
> Joseph
> 
> On Fri, Jul 24, 2015 at 2:02 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
> wrote:
> 
>> Please reply-all so the mailing list stays in the loop.
>> 
>> cumsum(1/(1:100)^2)
>> 
>> gives you the partial sums up through i=100.
>> ---------------------------------------------------------------------------
>> Jeff Newmiller                        The     .....       .....  Go Live...
>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
>> Go...
>>                                      Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
>> ---------------------------------------------------------------------------
>> Sent from my phone. Please excuse my brevity.
>> 
>> On July 24, 2015 10:30:09 AM PDT, Janh Anni <annijanh at gmail.com> wrote:
>>> Hello Jeff,
>>> 
>>> Thank you so much for the suggestion,  I searched cumsum as suggested
>>> but
>>> not sure it is what I had in mind.  For instance if I had the infinite
>>> series:    [image: Inline image 1]
>>> 
>>> and want to compute the sum of the, say, first 100 terms, how could I
>>> use
>>> cusum to do that?
>>> 
>>> Thanks again,
>>> 
>>> Janh
>>> 
>>> 
>>> On Thu, Jul 23, 2015 at 11:51 PM, Jeff Newmiller
>>> <jdnewmil at dcn.davis.ca.us>
>>> wrote:
>>> 
>>>> ?cumsum
>>>> 
>> 
>>> ---------------------------------------------------------------------------
>>>> Jeff Newmiller                        The     .....       .....  Go
>>> Live...
>>>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
>>>> Go...
>>>>                                      Live:   OO#.. Dead: OO#..
>>> Playing
>>>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>>>> /Software/Embedded Controllers)               .OO#.       .OO#.
>>> rocks...1k
>>>> 
>> 
>>> ---------------------------------------------------------------------------
>>>> Sent from my phone. Please excuse my brevity.
>>>> 
>>>> On July 23, 2015 8:23:39 PM PDT, Janh Anni <annijanh at gmail.com>
>>> wrote:
>>>>> Dear All,
>>>>> 
>>>>> Does anyone know of any R functions that compute partial sums of
>>>>> series?
>>>>> 
>>>>> Thanks in advance!
>>>>> 
>>>>> Janh
>>>>> 
>>>>>      [[alternative HTML version deleted]]
>>>>> 
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>> 
>>>> 
>> 
>> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.





More information about the R-help mailing list