MathGroup Archive 2001

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

Search the Archive

Re: [Q] Cancel command in 4.1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27711] Re: [mg27667] [Q] Cancel command in 4.1
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Mon, 12 Mar 2001 02:09:53 -0500 (EST)
  • References: <3AAAD96D.C262C62F@math.uncc.edu>
  • Sender: owner-wri-mathgroup at wolfram.com

Ok, if I get you right all you want to start with is how to construct a
stochastic matrix (i.e., all elements in [0,1] and sums across rows equal to
1). Then, for any m with elements in [0,1],

m/Apply[Plus,m,2]

gives you such a matrix. I propose a procedure to obtain the product inv . j
in general, for any dimension n:

In[1]:=
proc[n_] :=
  Module[{m = Table[Random[], {n}, {n}], i, j}, stoc = (m/Apply[Plus, m,
2]);
    i = IdentityMatrix[n];
    j = Table[{1}, {n}];
    inv = Inverse[lambda i - stoc];
    Map[Factor, inv.j, 3] // Rationalize]

When you call proc it will display inv . j (properly simplified) and it
leaves the stochastic matrix stoc available if you want to use it further. I
hope your n is not too large; otherwise you'll have to wait forever. For
example, for n = 8 (in a PC running at 800MHz):

In[2]:=
Timing[proc[8];]

Out[2]=
{16.31 Second, Null}

Tomas Garza
Mexico City




----- Original Message -----
From: "Janusz Kawczak" <jkawczak at math.uncc.edu>
To: mathgroup at smc.vnet.net
Burton" <tburton at cts.com>; "Chris Johnson" <cjohnson at shell.faradic.net>;
<tgarza01 at prodigy.net.mx>
Subject: [mg27711] RE: [mg27667] [Q] Cancel command in 4.1


> Thank you all for your help on:
>
> m={{.3,.7},{.4,.6}}
> i=IdentityMatrix[2]
> j={{1},{1}}
> inv=Inverse[lambda i - m]
> Cancel[Factor[inv.j]].
>
> Would you know whether a construct like a stochastic matrix can be build
> in
> Mathematica, i.e. a square matrix with 0<= p_{i,j} <= 1 and \sum_{over
> j} p_{i,j}=1 for all i.
> If so, how?
> As you may see in the above example, m is such a matrix and inv is a
> resolvent of
> that matrix. So, if P is a stochastic matrix I would like the dot
> product inv.j work in general,
> regardless of the dimension (but fix, n) and the numerical values for
> {p_{i,j}}.
>
> Thank you once more.
> John.
>



  • Prev by Date: Re: plot in different colors
  • Next by Date: plot matrix
  • Previous by thread: Re: [Q] Cancel command in 4.1
  • Next by thread: Q: plot in different colors