       Re: Iteratively determing successive values from previous values....

• To: mathgroup at smc.vnet.net
• Subject: [mg80395] Re: Iteratively determing successive values from previous values....
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Tue, 21 Aug 2007 05:03:10 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <fabnc6\$419\$1@smc.vnet.net>

```ashesh wrote:

> Need one help in determining the next value of a function from the
> previous values.
>
> Example:
>
> x(i+1) = x(i) + 1;
>
> If one iterates to find x(5), we should get it as (x(1) + 4), as the
> initial value is x(1), which is obtained
>
> x2 = x1+1;
> x3 = x2 + 1 = (x1+1) + 2 = x1 + 2
> x4 = x3 + 1 = (x2+1) + 1 = x2 + 2 = (x1+1) + 2 = x1 + 3
> x5 = x4 + 1 = (x3+1) + 1 = x3 + 2 = (x2+1) + 2 = x2 + 3 = x1 + 4

I an not sure what you are looking for but RSolve may be the answer.

In:= RSolve[{x[n] == x[n - 1] + 1, x == x1}, x[n], n]

Out= {{x[n] -> -1 + n + x1}}

> Similary, I would like to know how to deal if there are two variable
> expressions, say
>
> x(i+1) = x(i) - (s_i) * (2^-i) * y(i)
> y(i+1) = y(i) + (s_i) *(2^-i) * x(i)
>
> for i =1, we have
>
> x_2 = x1 - s_1 (2^-1) y_1
> y_2 = y1 + s_1 (2^-1) x_1
>
> and for i = 2 it becomes
> x_3 = x1* (1 - (s_1) * (s_2) * (2^-3)) - y1* ((s_1) *  (2^-1) + (s_2)
> * (2^-2))
> y_3 = y1* (1 - (s_1) * (s_2) * (2^-3))  + x1* ((s_1) * (2^-1) + (s_2)
> * (2^-2))
>
> and so on .....
>
> I have tried to use Table, Nest, and few other functional iteration
> procedures. But, they seem to be giving the product of the terms
> rather than substituting to give the SUM of the terms in iterative
> manner.

I cannot figure out what you did; the most likely is that you wrote an
erroneous pure function. Since you did not bother to write a single of
Mathematica code, it is hard to tell. The Nest expressions below return
the expected sum.

In:= Nest[# + 1 &, x1, 4]

Out= 4 + x1

In:= NestList[# + 1 &, x1, 4]

Out= {x1, 1 + x1, 2 + x1, 3 + x1, 4 + x1}

Anyway, the page tutorial/SolvingRecurrenceEquations in the