[R] Convergent series

David Bickel davidbickel.com+rhelp at gmail.com
Wed Jul 14 16:22:13 CEST 2010


Thanks, Ted. I meant to post this previous reply to the list:

On 10-07-14 07:43, David Bickel wrote:
> Hi Ted,
>
> Here are my translations to "integrate"-like syntax of a conflation of
> examples from the following Mathematica pages:
>
> x <- 2.232; sum(f = function(n) {x^n/factorial(n)}, lower = 0, upper =
> Inf, numeric.method = "HypergeometricTermZeilberger",
> verify.convergence = TRUE)
>
> Maybe there is an R function that will either add one term at a time
> until some specified tolerance level is met or that will add a
> specified number of terms but throw an error if the specified
> tolerance level is exceeded.
>
> Best regards,
> David
>
> http://reference.wolfram.com/mathematica/tutorial/SummationOfSeries.html
> http://reference.wolfram.com/mathematica/ref/Sum.html

List members, Ted's helpful reply follows.

David


On 10-07-14 08:48, (Ted Harding) wrote:
> Hi David,
> I think you should post this (and your previous reply) also to
> R-help, since there may be some people who know of something
> relevant. I'm not aware of any R function which operates on
> the lines of the "Mathematica-like" example you gave in the
> previous one.
>
> R is primarily oriented towards statistical computation, and
> mainly implements technical mathematical computations so far
> as they are needed for statistical purposes. Mathematica, on
> the other hand, is directly oriented to general mathematical
> computation.
>
> One issue (which is illustrated by the "Mathematica" example)
> is that the convergence criterion which should be applied for
> a given series will depend on what that series is. For example,
> in a series of alternating positive and negative terms, which
> successively decrease to zero in absolute value, the convergence
> criterion is easy: the error made in truncating the summation
> at a given term is less than the absolute value of the next term
> (and, also, convergence is guaranteed for any such series).
>
> On the other hand, the criterion to applied for the sum of a
> series like sum[from 0 to infinity]( 1/(n^alpha) ) (alpha>  1)
> is not so obvious, and may require a theoretical study specific
> to the particular series (indeed, some series have given rise
> to research articles studying their convergence which have been
> published over many years, their convergence may occupy whole
> chapters of textbooks on mathematical analysis, and the precise
> nature of their convergence could still be an ongoing problem).
>
> With best wishes,
> Ted.
>
>
> On 14-Jul-10 12:23:06, David Bickel wrote:
>
>> More generally, can R approximate the limit of a specified function as
>> an argument diverges? If so, I might be able to use a partial sum as
>> that specified function.
>>
>> David
>>
>>
>> On 14/07/2010 7:18 AM, (Ted Harding) wrote:
>>
>>> On 14-Jul-10 10:57:02, David Bickel wrote:
>>>
>>>
>>>> What are some reliable R functions that can compute the value of a
>>>> convergent series?
>>>>
>>>> David
>>>>
>>>>
>>> Please give an example of a definition (as you would specify it
>>> to an R function) of a "convergent series" that you want to compute!
>>>
>>> Your query is about as general as could possibly be, and cannot
>>> be presented to R as it stands, since a convergent series is an
>>> infinite sequence of terms which could be anything so long as the
>>> series converges.
>>>
>>> There are already many R functions -- such as sin(), exp() -- which
>>> compute values for specific convergent series, though often by
>>> special methods which do not work through the series of terms.
>>>
>>> Presumably a general series would be specified in terms of some
>>> rule which defines the nth term in terms of the (n-1)th, and
>>> possibly preceding, terms. Once such a specification has been
>>> given, an R function can be written. Are you thinking of something
>>> on the lines of
>>>
>>>     sersum<- function(x,fun1,fun)
>>>
>>> where fun1(x) would be a user-supplied function which computes
>>> the first term as a function of x, and fun(x,n,tn) a user-supplied
>>> function which computes term n in terms of tn=term (n-1), and n,
>>> for n>1?
>>>
>>> E.g. for the exponential series,
>>>
>>>     fun1<- function(x) 1
>>>     fun<- function(x,n,tn) tn*x/n
>>>
>>> Ted.
>>>
>>> --------------------------------------------------------------------
>>> E-Mail: (Ted Harding)<Ted.Harding at manchester.ac.uk>
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 14-Jul-10                                       Time: 12:18:22
>>> ------------------------------ XFMail ------------------------------
>>>
>>>
>> --
>> David R. Bickel, PhD
>> Associate Professor
>> Ottawa Institute of Systems Biology
>> Biochem., Micro. and I. Department
>> Mathematics and Statistics Department
>> University of Ottawa
>> 451 Smyth Road
>> Ottawa, Ontario K1H 8M5
>>
>> http://www.statomics.com
>>
>> Office Tel: (613) 562-5800 ext. 8670
>> Office Fax: (613) 562-5185
>> Office Room: RGN 4510F (Follow the signs to the elevator, and take it
>> to the fourth floor. Turn left and go all the way to the end of the
>> hall, and enter the door to the OISB area.)
>> Lab Tel.: (613) 562-5800 ext. 8304
>> Lab Room: RGN 4501T
>>
>>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding)<Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 14-Jul-10                                       Time: 13:48:29
> ------------------------------ XFMail ------------------------------
>


-- 
David R. Bickel, PhD
Associate Professor
Ottawa Institute of Systems Biology
Biochem., Micro. & I. Department
Mathematics & Statistics Department
University of Ottawa
451 Smyth Road
Ottawa, Ontario K1H 8M5

http://www.statomics.com

Office Tel: (613) 562-5800 ext. 8670
Office Fax: (613) 562-5185
Office Room: RGN 4510F
Lab Tel.: (613) 562-5800 ext. 8304
Lab Room: RGN 4501T



More information about the R-help mailing list