MathGroup Archive 1999

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

Search the Archive

Re: Simplifying Matrix Product.. a partial answer??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20739] Re: [mg20695] Simplifying Matrix Product.. a partial answer??
  • From: "Mark E. Harder" <harderm at ucs.orst.edu>
  • Date: Wed, 10 Nov 1999 00:17:50 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Phil,
    If FullSimplify[DERR.INVR] is the only approach you have tried, your
progress has been stymied by at least 3 problems that I could identify, so
far, although I can suggest some ways around them.  First, even Simplify,
with out the Trig Simplifications that FS tries to do, can be very slow and
inefficient.  The problem you have is in performing the various trig
simplifications on the trig function polynomials that result from the dot
products within the matrix multiplication.  Since these functions,
TrigExpand, TrigReduce, and TrigFactor can be used separately, I tried using
them as such and some interesting patterns emerged, which I could use to
think about the problem further.  Second, since the problem is not in
multiplying the matrices, but in simplifying the elements,  you are wasting
a lot of time and getting no information in the process by trying to FS the
*whole 2x3 matrix result* at once.  My guess is that information learned by
trying to simplify one matrix *element* will be applicable to the overall
problem, since there will be many common terms and subproblems in a problem
like this.  So I performed the following command first:
Dot[DERR[[1]],TakeColumns[INVR,{1}] ]
and tried simplifying only this, the [[1,1]] element of the product.
TrigReduce[%] yielded a trig polynomial with ~100 terms collected into
subexpressions like
( -2 gammadot Sin[2 gamma-phi+2 psi]+2 phidot Sin[2 gamma-phi+2 psi]-2
psidot Sin[2 gamma-phi+2 psi] ) and also
(2 gammadot Cos[2 gamma-phi+2 psi]+2 psidot Cos[2 gamma-phi+2 psi]). Note
that the arguments are the same.  So I tried to use TrigFactor, which should
factor trig polynomials and apply trig identities to the entire
polynomial--- but this accomplished nothing (although it only took ~2min. to
find this out on my Win NT, 266MHz Pent.II machine).  I was puzzled by this
failure so I tried factoring just these terms separately:
In[41]:=
TrigFactor[2 gammadot Cos[2 gamma-phi+2 psi]+2 psidot Cos[2 gamma-phi+2
psi] ]
Out[41]=
2 (gammadot+psidot) Cos[2 gamma-phi+2 psi]
&
In[40]:=
TrigFactor[-2 gammadot Sin[2 gamma-phi+2 psi]+2 phidot
  Sin[2 gamma-phi+2 psi]-2 psidot Sin[2 gamma-phi+2 psi] ]
Out[40]=
-2 (gammadot-phidot+psidot) Sin[2 gamma-phi+2 psi]

Attempting to TrigFactor[] the sum of the Cos & Sin terms in the arguments
of the above, however, produced nothing (Try it)!!!  I don't understand why
Mathematica refuses to simplify the more lengthy polynomial when it can
understand the component problems.  But it points out the third problem that
you have been having.  By subsuming all this work into one FS command, you
are letting Mathematica encounter roadblocks of its own making, and then
hide that fact from you.  Somehow, to make progress here, we need to find a
way to get TrigFactor to distribute over the whole polynomial.  I suggest
that you do this from the bottom up, so to speak, as in the above examples.

I hope that helps.
-mark



-----Original Message-----
From: tsao_please_dont_send_spam at its.caltech.edu
To: mathgroup at smc.vnet.net
<tsao_please_dont_send_spam at its.caltech.edu>
Subject: [mg20739] [mg20695] Simplifying Matrix Product


>I'm having a little trouble simplifying a product of two matrices on
>Mathematica 3.0 for Solaris and Linux. My two matrices are
>
>DERR = {{-(psidot*Cos[psi]*Sin[gamma]) +
>     Cos[psi]*(-(gammadot*Cos[phi]*Sin[gamma]) -
>        phidot*Cos[gamma]*Sin[phi]) - gammadot*Cos[gamma]*Sin[psi] -
>     psidot*Cos[gamma]*Cos[phi]*Sin[psi],
>    -(gammadot*Cos[gamma]*Cos[psi]) -
>     Cos[psi]*(-(gammadot*Cos[phi]*Sin[gamma]) -
>        phidot*Cos[psi]*Sin[phi]) + psidot*Cos[gamma]*Cos[phi]*Sin[psi] +
>     psidot*Sin[gamma]*Sin[psi],
>    phidot*Cos[gamma]*Cos[phi] - gammadot*Sin[gamma]*Sin[phi]},
>   {(-(phidot*Cos[gamma]*Cos[phi]) + gammadot*Sin[gamma]*Sin[phi])*
>     (gammadot*Cos[gamma]*Cos[psi] +
>       Cos[psi]*(-(gammadot*Cos[phi]*Sin[gamma]) -
>          phidot*Cos[psi]*Sin[phi]) - psidot*Cos[gamma]*Cos[phi]*Sin[psi] -
>       psidot*Sin[gamma]*Sin[psi]),
>    (phidot*Cos[phi]*Sin[gamma] + gammadot*Cos[gamma]*Sin[phi])*
>     (gammadot*Cos[psi]*Sin[gamma] + psidot*Cos[phi]*Cos[psi]*Sin[gamma] +
>       psidot*Cos[gamma]*Sin[psi] +
>       (gammadot*Cos[gamma]*Cos[phi] -
phidot*Sin[gamma]*Sin[phi])*Sin[psi]),
>    phidot*Sin[phi]*(phidot*Cos[phi]*Sin[gamma] +
>       gammadot*Cos[gamma]*Sin[phi])}}
>
>INVR = {{Cos[gamma]*Cos[phi]*Cos[psi] - Sin[gamma]*Sin[psi],
>    Cos[psi]*Sin[gamma] + Cos[gamma]*Cos[phi]*Sin[psi],
>    -(Cos[gamma]*Sin[phi])}, {-(Cos[phi]*Cos[psi]*Sin[gamma]) -
>     Cos[gamma]*Sin[psi], Cos[gamma]*Cos[psi] -
>     Cos[phi]*Sin[gamma]*Sin[psi], Sin[gamma]*Sin[phi]},
>   {Cos[psi]*Sin[phi], Sin[phi]*Sin[psi], Cos[phi]}}
>
>I type in the following...
>
>FullSimplify[ DERR . INVR ]
>
>...and the UltraSPARC-60 has been chugging for about 12 hours now. Any
>ideas??
>
>Cheers,
>Phil
>
>
>



  • Prev by Date: ReadList
  • Next by Date: Re: Constrained optimization.
  • Previous by thread: Crypto under mathematica
  • Next by thread: notebook interface problem in Mathematica 4