       # Re: writing out a general n-th order iterative eqn.

• To: mathgroup@smc.vnet.net
• Subject: [mg10365] Re: writing out a general n-th order iterative eqn.
• From: Paul Abbott <paul@physics.uwa.edu.au>
• Date: Mon, 12 Jan 1998 04:09:59 -0500
• Organization: University of Western Australia
• References: <69498b\$i7b@smc.vnet.net>

```V. Nagarajan wrote:

>         I have an n-th order eqn.,
>
>         {rho^(n) (t)}ij = {A(t)}ij (x) {B(t).rho^(n-1) - rho^(n-1).B(t)}ij
>
>         ^ = superscript
>         {..}ij = ij-th matrix element
>         . = scalar multiplication
>
>         The equation gets quite tedious upon substituting for the lower
>         order successively because {x.y}ij = Sum(k=1,N)({x}ik.{y}kl).
>         For N=2 and n=3, i can express rho^(3) as a function of rho^(0)
>         fairly easily. It is when these integers get to be larger,
>         the bookkeeping gets to be horrendous.

See below for an appended Mathematica Notebook which attempts to do this
computation.

Cheers,
Paul

____________________________________________________________________
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907
mailto:paul@physics.uwa.edu.au  AUSTRALIA
http://www.pd.uwa.edu.au/~paul

God IS a weakly left-handed dice player
____________________________________________________________________

Notebook[{
Cell[TextData[{
"I think that your recursive expression ",
Cell[BoxData[
\`{\(\[Rho]\^n\)(t)}\_\(i, j
\)\  = {A(t)}\_\(i, j
\)\[Times]\ {
\(B(t)\) . \(\(\[Rho]\^\(n - 1\)\)(t)\)\  - \
\(\(\[Rho]\^\(n - 1\)\)(t)\) . \(B(t)\)}\_\(i, j\)\)]],
" can be coded as follows. Starting condition:" }], "Text"],

Cell[BoxData[
FormBox[
RowBox[{
RowBox[{\(\[Rho]\_0\), "=",

FormBox[\(Function[{t}, Table[\[Rho]\_\(i, j\)[t], {i, 2}, {j,
2}]]
\),

Cell["\<\
and recursion (using dynamic programming and pure functions):\ \>",
"Text"],

Cell[BoxData[
\`\[Rho]\_\(n_ /; n > 0\) :=
\(\[Rho]\_n =
Function[{t},
A[t] \((B[t] . \[Rho]\_\(n - 1\)[t] - \[Rho]\_\(n - 1\)[t] .
B[t])
\)]\)\)], "Input"],

Cell[TextData[{
"Matrix products of the form ",
Cell[BoxData[
" can be computed without using indices using ordinary multiplication.
For \
example, with"
}], "Text"],

Cell[CellGroupData[{

Cell[BoxData[
\(TraditionalForm\`A[t] = Table[a\_\(i, j\)[t], {i, 2}, {j, 2}]\)],
"Input"],

Cell[BoxData[
FormBox[
RowBox[{"(", GridBox[{
{\(\(a\_\(1, 1\)\)(t)\), \(\(a\_\(1, 2\)\)(t)\)},
{\(\(a\_\(2, 1\)\)(t)\), \(\(a\_\(2, 2\)\)(t)\)}
}], ")"}], TraditionalForm]], "Output"] }, Open  ]],

Cell["and", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
\(TraditionalForm\`B[t] = Table[b\_\(i, j\)[t], {i, 2}, {j, 2}]\)],
"Input"],

Cell[BoxData[
FormBox[
RowBox[{"(", GridBox[{
{\(\(b\_\(1, 1\)\)(t)\), \(\(b\_\(1, 2\)\)(t)\)},
{\(\(b\_\(2, 1\)\)(t)\), \(\(b\_\(2, 2\)\)(t)\)}
}], ")"}], TraditionalForm]], "Output"] }, Open  ]],

Cell["ordinary multiplication of these two matrices yields", "Text"],

Cell[CellGroupData[{

Cell[BoxData[

Cell[BoxData[
FormBox[
RowBox[{"(", GridBox[{
{\(\(\(a\_\(1, 1\)\)(t)\)\ \(\(b\_\(1, 1\)\)(t)\)\),
\(\(\(a\_\(1, 2\)\)(t)\)\ \(\(b\_\(1, 2\)\)(t)\)\)},
{\(\(\(a\_\(2, 1\)\)(t)\)\ \(\(b\_\(2, 1\)\)(t)\)\),
\(\(\(a\_\(2, 2\)\)(t)\)\ \(\(b\_\(2, 2\)\)(t)\)\)}
}], ")"}], TraditionalForm]], "Output"] }, Open  ]],

Cell[TextData[{
"which is the sort of multiplication you want (I think).  Here is ",
Cell[BoxData[
":"
}], "Text"],

Cell[CellGroupData[{

Cell[BoxData[

Cell[BoxData[
FormBox[
RowBox[{"(", GridBox[{
{
\(\(\(a\_\(1, 1\)\)(t)\)\
\((\(\(b\_\(1, 2\)\)(t)\)\ \(\(\[Rho]\_\(2, 1\)\)(t)\) -

\(\(b\_\(2, 1\)\)(t)\)\ \(\(\[Rho]\_\(1,
2\)\)(t)\))\)\),
\(\(\(a\_\(1, 2\)\)(t)\)\
\((\((\(b\_\(1, 1\)\)(t) - \(b\_\(2, 2\)\)(t))\)\
\(\(\[Rho]\_\(1, 2\)\)(t)\) +
\(\(b\_\(1, 2\)\)(t)\)\
\((\(\[Rho]\_\(2, 2\)\)(t) - \(\[Rho]\_\(1,
1\)\)(t))\))
\)\)},
{
\(\(\(a\_\(2, 1\)\)(t)\)\
\((\((\(b\_\(2, 2\)\)(t) - \(b\_\(1, 1\)\)(t))\)\
\(\(\[Rho]\_\(2, 1\)\)(t)\) +
\(\(b\_\(2, 1\)\)(t)\)\
\((\(\[Rho]\_\(1, 1\)\)(t) - \(\[Rho]\_\(2,
2\)\)(t))\))
\)\), \(\(\(a\_\(2, 2\)\)(t)\)\
\((\(\(b\_\(2, 1\)\)(t)\)\ \(\(\[Rho]\_\(1, 2\)\)(t)\) -

\(\(b\_\(1, 2\)\)(t)\)\ \(\(\[Rho]\_\(2,
1\)\)(t)\))\)\)}
}], ")"}], TraditionalForm]], "Output"] }, Open  ]]
}
]

```

• Prev by Date: Re: Rotate3D bug solution
• Next by Date: How to draw full text in graphics
• Prev by thread: writing out a general n-th order iterative eqn.
• Next by thread: tensor/matrix calculations