[R] evaluate sum of sum

Rolf Turner r.turner at auckland.ac.nz
Thu Jul 16 05:33:45 CEST 2009


On 16/07/2009, at 2:30 PM, Roslina Zakaria wrote:

> Hi R-users,
>
> Could anybody show me how to write a code to evaluate sum(z[i] + sum 
> (k[j]*(z[i])^(k[j])), i=1 to 4, j=0 to infinity) ?

No.  No-one can.  It is conceptually impossible.

(a) Computers cannot do infinite sums; they can only do finite ones.

(b) Attempting to approximate infinite sums by finite ones that  
computers
can do is theoretically possible, but fraught with peril.  E.g. try  
summing
{1/(j+1)} from 0 to infinity that way.  You may, after a long while,  
get a
finite answer .....

(c) What is k[j] equal to?  You must have an expression for it, elsewise
your question makes no sense at all.

If the sequence k[j] is sufficiently nice then you may be able to  
determine
error bounds.  I.e. for a given epsilon, find an M_0 such that the  
sum from
0 to M is within epsilon of the sum to infinity for any M >= M_0.

The sum from 0 to M is easy to calculate.

	cheers,

		Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list