MathGroup Archive 2012

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

Search the Archive

Re: MatrixPower problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124112] Re: MatrixPower problem
  • From: per at RQNNE.invalid (Per Rønne)
  • Date: Mon, 9 Jan 2012 03:19:35 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <je96q1$j7o$1@smc.vnet.net> <jebnjq$1cs$1@smc.vnet.net>
  • Reply-to: spam at RQNNE.dk (Per Rønne)

David Bailey <dave at removedbailey.co.uk> wrote:

> On 07/01/2012 10:29, Per R=F8nne wrote:
> > I have defined the following matrix:
> >
> > P = {{0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0},
> >         {0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0}, {0, 0, 1/3, 0, 1}}
> >
> > And the following vector:
> >
> > e1 = {1, 0, 0, 0, 0}
> >
> > I try to solve:
> >
> > Limit[MatrixPower[P, k].e1, k ->  \[Infinity]]
> >
> > And get the correct result:
> >
> > Out[7] = {0, 0, 0, 0, 1}
> >
> > But if I write the first statement as:
> >
> > P = {{0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0},
> >         {0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0}, {0, 0, 1/3, 0, 1}}
> > //MatrixForm
> >
> > I will not only get a more readle Out-format of the matrix. My
> > Mathematica 8.1 for Students will also deny to calculate what is
> > demanded. It will just list
> >
> > Limit[MatrixPower[P, k].e1, k ->  \[Infinity]]
> >
> > with P replaced with the contents of the 5*5 matrix.
> >
> > I simply don't understant why.
> >
> >
> > The output I can be pasted as:
> >
> > At least I get the following output:
> >
> > Limit[MatrixPower[\!\(\*
> > TagBox[
> > RowBox[{"(", "", GridBox[{
> > {"0",
> > FractionBox["1", "2"], "0",
> > FractionBox["1", "2"], "0"},
> > {
> > FractionBox["1", "2"], "0",
> > FractionBox["1", "3"], "0", "0"},
> > {"0",
> > FractionBox["1", "2"], "0",
> > FractionBox["1", "2"], "0"},
> > {
> > FractionBox["1", "2"], "0",
> > FractionBox["1", "3"], "0", "0"},
> > {"0", "0",
> > FractionBox["1", "3"], "0", "1"}
> > },
> > GridBoxAlignment->{
> >           "Columns" ->  {{Center}}, "ColumnsIndexed" ->  {},
> >            "Rows" ->  {{Baseline}}, "RowsIndexed" ->  {}},
> > GridBoxSpacings->{"Columns" ->  {
> > Offset[0.27999999999999997`], {
> > Offset[0.7]},
> > Offset[0.27999999999999997`]}, "ColumnsIndexed" ->  {}, "Rows" ->  {
> > Offset[0.2], {
> > Offset[0.4]},
> > Offset[0.2]}, "RowsIndexed" ->  {}}], "", ")"}],
> > Function[BoxForm`e$,
> > MatrixForm[BoxForm`e$]]]\), k].{1, 0, 0, 0, 0}, k ->  \[Infinity]]
> >
> 
> The following expression is wrong:
> 
> P = {{0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0},
>         {0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0}, {0, 0, 1/3, 0, 1}}
> //MatrixForm
> 
> To see what is wrong, type P//FullForm
> 
> As you will see, the MatrixForm has become part of the expression
> contained in P!

Yes, I see. I just fail to see the purpose of such a behaviour.

> Instead write:
> 
> P = {{0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0},
>         {0, 1/2, 0, 1/2, 0}, {1/2, 0, 1/3, 0, 0}, {0, 0, 1/3, 0, 1}};
> 
> P//MatrixForm

Another poster has suggested I put the assignment statement in
parentheses and place the //MatrixForm after the end parenthesis. A
third that I make a MatrixForm[P] instead of your P//MatrixForm.

Well, I have received two replies in my inbox that have not yet come
through to the moderated usenet group.

> BTW, it is best to avoid variables that start with a capital letter, as
> these can clash with new definitions in later versions of Mathematica.

I know. But in this case it is being used in a Linear Algebra assignment
at college. And in the assignment (meant for another system) capital P is used.

BTW, this other system proved unable to calculate Limit[MatrixPower[P, k].e1, k -> \[Infinity]]. Well, limit(P^k.e1,k=infinity).

Instead, you have to manually simplify the problem before it is handled
over to the other system. Which may be good for learners - but cumbersome for
users.

P contains probabilities. Consequently, every column adds up to 1.
-- 
Per Erik Rønne
http://www.RQNNE.dk
Errare humanum est, sed in errore perseverare turpe



  • Prev by Date: Re: For a variety of plotting experiences, maybe bugs?
  • Next by Date: Embedding Header and Footer settings in a stylesheet
  • Previous by thread: Re: MatrixPower problem
  • Next by thread: Re: MatrixPower problem