Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg80412] Re: Iteratively determing successive values from previous values....
  • From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 22 Aug 2007 04:36:25 -0400 (EDT)
  • References: <fabnc6$419$1@smc.vnet.net> <46C96DC6.3000906@gmail.com>

ashesh cb <ashesh.cb at gmail.com> wrote:

> Sir,
>
> Thank you for your response. I have attached a Mathematica notebook in which
> I have represented what I exactly need.
>
> In the attached file, I have computed up to X_4 and Y_4. but, I actually
> need to calculate up to X_15 and Y_15. I want to do these calculations
> recursively so that I do not have to copy-paste the code for each higher
> term manually.

Here is the content of the attached notebook:

(* Beginning of program1.nb *)

Subscript[x, 2] =
  Subscript[x, 1] - m Subscript[\[Sigma], 1] Subscript[y, 1] 2^-i;
Subscript[y, 2] =
  Subscript[y, 1] +  Subscript[\[Sigma], 1] Subscript[x, 1] 2^-i;
 Subscript[x, 3] =
  Subscript[x, 2] -
   m Subscript[\[Sigma], 2] Subscript[y, 2] 2^(-2 i);
Subscript[y, 3] =
  Subscript[y, 2] + Subscript[\[Sigma], 2] Subscript[x, 2] 2^(-2 i);
Subscript[x, 4] =
  Subscript[x, 3] -
   m Subscript[\[Sigma], 3] Subscript[y, 3] 2^(-3 i);
Subscript[y, 4] =
  Subscript[y, 3] + Subscript[\[Sigma], 3] Subscript[x, 3] 2^(-3 i);
Subscript[x, 5] =
  Subscript[x, 4] -
   m Subscript[\[Sigma], 4] Subscript[y, 4] 2^(-4 i);
Subscript[y, 5] =
  Subscript[y, 4] + Subscript[\[Sigma], 4] Subscript[x, 4] 2^(-4 i);
Subscript[x, 6] =
  Subscript[x, 5] -
   m Subscript[\[Sigma], 5] Subscript[y, 5] 2^(-5 i);
Subscript[y, 6] =
  Subscript[y, 5] + Subscript[\[Sigma], 5] Subscript[x, 5] 2^(-5 i);
Subscript[x, 7] =
 Collect[ Subscript[x, 6] -
   m Subscript[\[Sigma], 6] Subscript[y, 6] 2^(-6 i), {Subscript[x,
   1], Subscript[y, 1]}]
Subscript[y, 7] =
 Collect[
  Subscript[y, 6] +
   Subscript[\[Sigma], 6] Subscript[x, 6] 2^(-6 i), {Subscript[x, 1],
   Subscript[y, 1]}]

(* End of prgram1.nb *)

I believe that you should not have the free variable 'i' hanging
around. Anyway, what you are looking for is a recursive definition of
the coupled difference equations. You can do that as follows.

In[1]:= Clear[x, y];
x[1] = Subscript[x, 1];
y[1] = Subscript[y, 1];
x[n_] := x[n] =
  x[n - 1] - m Subscript[\[Sigma], n - 1] y[n - 1] 2^(-(n - 1) i)
y[n_] := y[n] =
  y[n - 1] + Subscript[\[Sigma], n - 1] x[n - 1] 2^(-(n - 1) i)

In[6]:= Table[{x[n], y[n]}, {n, 4}]

Out[6]= {{Subscript[x, 1], Subscript[y,
  1]}, {Subscript[x, 1] -
   2^-i m Subscript[y, 1] Subscript[\[Sigma], 1],
  Subscript[y, 1] +
   2^-i Subscript[x, 1] Subscript[\[Sigma], 1]}, {Subscript[x, 1] -
   2^-i m Subscript[y, 1] Subscript[\[Sigma], 1] -
   2^(-2 i) m (Subscript[y, 1] +
      2^-i Subscript[x, 1] Subscript[\[Sigma], 1]) Subscript[\[Sigma],
     2], Subscript[y, 1] +
   2^-i Subscript[x, 1] Subscript[\[Sigma], 1] +
   2^(-2 i) (Subscript[x, 1] -
      2^-i m Subscript[y, 1] Subscript[\[Sigma],
       1]) Subscript[\[Sigma], 2]}, {Subscript[x, 1] -
   2^-i m Subscript[y, 1] Subscript[\[Sigma], 1] -
   2^(-2 i) m (Subscript[y, 1] +
      2^-i Subscript[x, 1] Subscript[\[Sigma], 1]) Subscript[\[Sigma],
     2] -
   2^(-3 i) m (Subscript[y, 1] +
      2^-i Subscript[x, 1] Subscript[\[Sigma], 1] +
      2^(-2 i) (Subscript[x, 1] -
         2^-i m Subscript[y, 1] Subscript[\[Sigma],
          1]) Subscript[\[Sigma], 2]) Subscript[\[Sigma], 3],
  Subscript[y, 1] + 2^-i Subscript[x, 1] Subscript[\[Sigma], 1] +
   2^(-2 i) (Subscript[x, 1] -
      2^-i m Subscript[y, 1] Subscript[\[Sigma],
       1]) Subscript[\[Sigma], 2] +
   2^(-3 i) (Subscript[x, 1] -
      2^-i m Subscript[y, 1] Subscript[\[Sigma], 1] -
      2^(-2 i) m (Subscript[y, 1] +
         2^-i Subscript[x, 1] Subscript[\[Sigma],
          1]) Subscript[\[Sigma], 2]) Subscript[\[Sigma], 3]}}


> In addition to the calculations, I need to know as to how many terms are
> there in each of the for x_1 and y_1 for each of x_4 and y_4. In addition to
> that, I need to know as to how many terms form each component of x_1 and y_1
> and what the power of 2 is?.
>
> That is corresponding to x_4 =>
>
> 1.  I need to know that there are 4 terms which have x1 in common and 4 with
> y1 in common.

You could use Collect and Length as in

In[7]:= Collect[x[4], {Subscript[x, 1], Subscript[y, 1]}]

Out[7]= Subscript[x,
  1] (1 - 2^(-3 i) m Subscript[\[Sigma], 1] Subscript[\[Sigma], 2] -
    2^(-4 i) m Subscript[\[Sigma], 1] Subscript[\[Sigma], 3] -
    2^(-5 i) m Subscript[\[Sigma], 2] Subscript[\[Sigma], 3]) +
 Subscript[y,
  1] (-2^-i m Subscript[\[Sigma], 1] -
    2^(-2 i) m Subscript[\[Sigma], 2] -
    2^(-3 i) m Subscript[\[Sigma], 3] +
    2^(-6 i) m^2 Subscript[\[Sigma], 1] Subscript[\[Sigma], 2]
      Subscript[\[Sigma], 3])

In[8]:= Length[Collect[x[4], Subscript[x, 1]]] - 1

Out[8]= 4

In[9]:= Length[Collect[x[4], Subscript[y, 1]]] - 1

Out[9]= 4

> 2. How many sigma's are there with each of the 4 terms that have x1 in
> common and what their signs are? Similar details for y1 are needed
>
> The paper in which the above iterative procedure was implemented is also
> attached to this email. The authors had implemented it using another
> programming language (page 184-185). The authors have tabulated the details
> corresponding to (x4, x5 in page 185) in Table.1. I was unable to think as
> to how it can be done in another CAS, so I have been trying to do it in
> MATHEMATICA.
>
> I will be thankful for any help in implementation of the above procedure.
>
> Thanking you.
>
>  with regards,
> Ashesh

-- 
Jean-Marc


  • Prev by Date: Re: Missing information in Mathematica 6.0 Documentation
  • Next by Date: Re: lower diagonal matrix
  • Previous by thread: Re: Iteratively determing successive values from previous values....
  • Next by thread: Manipulate with Wrapping SetterBars