Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

RE: common factors in a matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33596] RE: common factors in a matrix
  • From: Bart Vorselaars <fourteen at stack.nl>
  • Date: Wed, 3 Apr 2002 01:13:18 -0500 (EST)
  • Organization: Eindhoven University of Technology, The Netherlands
  • References: <a86ki1$jsj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Thanks for responding to my question. The routine I use now, is a altered
version of David's FactorMatrix[mat]. This can handle any matrix (I think
:), even ones which are already 'factorized':

(*Remove common factors :*)
FactorMatrix2[(mat_)?MatrixQ] :=
  Module[{contracted, flatmat, fcontracted,
      prefactor, \[CapitalPsi]\[CapitalPsi]\[CapitalPsi], mult1, mult2},
    contracted = 0; flatmat = Flatten[mat];
    Do[contracted =
        contracted +
          flatmat[[ii]]*\[CapitalPsi]\[CapitalPsi]\[CapitalPsi][ii], {ii,
1,
        Length[flatmat]}]; fcontracted = Factor[contracted];
    If[Head[fcontracted] === Head[mult1 mult2],
      prefactor = Drop[fcontracted, -1];
      HoldForm @@ {prefactor}*
        MatrixForm[Map[Cancel[#1/prefactor] &, mat, {2}]],
MatrixForm[mat]]]


Bart






  • Prev by Date: Re: Mathlink formulas return different results
  • Next by Date: Math::ematica Perl module
  • Previous by thread: Re: Mathlink formulas return different results
  • Next by thread: Math::ematica Perl module