[R] Convergent series
(Ted Harding)
Ted.Harding at manchester.ac.uk
Wed Jul 14 13:18:25 CEST 2010
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 ------------------------------
More information about the R-help
mailing list