[Date Index]
[Thread Index]
[Author Index]
Re: all the possible minors of a matrix
*To*: mathgroup at smc.vnet.net
*Subject*: [mg73792] Re: all the possible minors of a matrix
*From*: "janos" <janostothmeister at gmail.com>
*Date*: Wed, 28 Feb 2007 04:40:25 -0500 (EST)
*References*: <es13bi$o3s$1@smc.vnet.net>
On Feb 27, 12:06 pm, Mark Novak <mno... at uchicago.edu> wrote:
> Hello,
>
> I'm trying to recode a script into Mathematica and am stuck.
>
> My problem in short:
> I need to calculate all minors of a matrix, but can't figure out a way
> to get Mathematica to do more than just a specifically assigned minor at
> a time (e.g., the minor produce by removing column 1, row 1).
>
> My problem in long version:
> (I've posted an explanation with example matrices and links to the code
> I have written athttp://home.uchicago.edu/~mnovak/mathematicahelp.html)
>
> The original line is
> T:=matrix(n,n,(i,j)->permanent(minor(abs(A),j,i))):evalm(T);
>
> So, given a matrix A of dimensions n by n, determine the n x n different
> minors of the |A| matrix (each minor being of size n-1 by n-1), then
> calculate the permanent of each of these minors, and put the resultant
> single value into the relevant position of an n by n matrix. That is,
> the permanent of the minor produced by removing the ith row and jth
> column goes into position (i,j).
>
> First we need to define how we want the Minor of a matrix to be
> calculated (Mathematica's "Minors" function does it in a way that we
> don't want.) Second, Mathematica doesn't have a function for calculating
> a matrix's permanent, so we need to define that function. (Both of these
> I got from searching the the Mathgroup forum.)
>
> Minor[m_List?MatrixQ, {i_Integer,
> j_Integer}]:=Abs[Drop[Transpose[A],{j}]],{i}]]
> Permanent[m_List]:=With[{v=Array[x,Length[m]]},Coefficient[Times@@(m.=
v),Times@@v]]
>
> Then the following does work....
>
> Minor[Abs[A],{1,3}]//MatrixForm
> Permanent[Minor[Abs[A],{i,j}]]/.{i->1,j->1}
>
> But the problem is that while I can do each of the Minor and Permanent
> calculations for specified rows i & columns j of the matrix, I can't
> figure out how to do all n x n possible combinations of i and j.
>
> Any suggestions would be much appreciated.
> Thanks!
> -mark
>
> --
>
> ***************************************
> Dept. of Ecology & Evolution
> 1101 E. 57th St., U. of Chicago
> Chicago, IL 60637
> Office/Lab: 773-702-4815
> Fax: 773-702-9740http://home.uchicago.edu/~mnovak/
> ***************************************
I show you how to calculate all the subdeterminants of the 3x3 matrix
A=2E
s = Subsets[Range[3]];
tr = Transpose[{s, s}];
A = {{a, b, c}, {d, e, f}, {g, h, j}};
tap = Table[Apply[Part[A, ##] &, tr=E3=80=9Ai=E3=80=9B], {i, 2, 2^3}](*UG=
LY*)
If you wish you can calculat the detrminants (you would prefer
permanents) of these submatrices as
Map[Det,tap]
1=2E I hope this helps.
2=2E The UGLY step can be made much more elegantly, would need some
time.
Janos
Prev by Date:
**Re: Re: Re: deleting a title or subtitle in a notebook**
Next by Date:
**Re: conditional is giving wrong value**
Previous by thread:
**Re: all the possible minors of a matrix**
Next by thread:
**Integrate[Abs[Cos[u]], u] for u real**
| |