Re: [R] vectorizing an iterative process.

2006-12-27 Thread Martin Maechler
Geoffrey == Geoffrey Zhu [EMAIL PROTECTED] on Tue, 26 Dec 2006 10:05:55 -0600 writes: Geoffrey I meant x[i] - x[i-1] + y[i-1] and Y[i] - y[i-1] + x[i] below. Geoffrey The mailing list software just keep adding 3D's. Sorry. It's not the mailing list software - not per se at least.

[R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
Hi Everyone, I am stuck with a simple problem. Suppose I have a vector x, and I want to calculate y[i]=3Dx[i+1]-x[i], it is very easy. I just need to write y-x[2:length(x)]-x[1:length(x)-1]. Now if I know y, and want to know the vector x defined by x[i]=3Dx[i-1]+y[i-1] for all i, how can I do

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Richard M. Heiberger
x[i]=3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? It looks like x - cumsum(y) What does 3D mean? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
PROTECTED] Sent: Tuesday, December 26, 2006 9:56 AM To: Geoffrey Zhu; r-help@stat.math.ethz.ch Subject: Re: [R] vectorizing an iterative process. x[i]=3D3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? It looks like x - cumsum(y) What does 3D mean

Re: [R] vectorizing an iterative process.

2006-12-26 Thread hadley wickham
x[i]=3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? It looks like x - cumsum(y) What does 3D mean? The =3D is probably an encoding error - it should just be =. In general to vectorise an iterative problem, you will need to solve the recurrence relation

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
-help@stat.math.ethz.ch Subject: Re: [R] vectorizing an iterative process. Hi Richard, 3D is automatically generated by the mailing list software, probably because I had ] followed by =3D3D without a space in the original post. What I meant was to calculate x[i] =3D3D x[i-1] + y[i-1] For example

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Christos Hatzis
-help@stat.math.ethz.ch Subject: Re: [R] vectorizing an iterative process. I meant x[i] - x[i-1] + y[i-1] and Y[i] - y[i-1] + x[i] below. The mailing list software just keep adding 3D's. Sorry. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey Zhu

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
Yes, this solves my problem. Thanks for your help. -Original Message- From: Christos Hatzis [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 26, 2006 10:58 AM To: Geoffrey Zhu; r-help@stat.math.ethz.ch Subject: RE: [R] vectorizing an iterative process. In your case, the recurrence

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Peter Dalgaard
. Heiberger [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 26, 2006 9:56 AM To: Geoffrey Zhu; r-help@stat.math.ethz.ch Subject: Re: [R] vectorizing an iterative process. x[i]=3D3D3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? It looks like x - cumsum(y) What does 3D