MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80389] Re: Iteratively determing successive values from previous values....
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 21 Aug 2007 05:00:04 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <fabnc6$419$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,


> Example:
> 
> x(i+1) = x(i) + 1;

would be
   Nest[#+1 &,x1,n]

or
f[x1_,0]:=x1
f[x1_,n_Integer]:=1+f[x1,n-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
> 
> 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))
> 

With[{n=2},
   Fold[
     # + {-1, 1}*#*#2/2 &, {x, y}, Table[s[i], {i, n}]]
]

> 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.

hmm -- it seem s that it ork fine with Nest[] and Fold[]
so what you have done ??

Regards
   Jens


  • Prev by Date: Re: Documentation Center (Mathematica Help) problem and solution
  • Next by Date: Fwd: Mathematica 6.0 bug in computing MathieuC
  • Previous by thread: Iteratively determing successive values from previous values....
  • Next by thread: Re: Iteratively determing successive values from previous values....