Message Boards Message Boards

How to factor out a more complicated expression?

Posted 10 years ago
8 A Ac L01 L02+16 A Ac L03^2+8 I A Bc E6-8 A Bc L03 L04+16 A Bc L03 L05+8 A Bc L03 L06+8 I A Cc E3-8 A Cc L03 L07+16 A Cc L03 L08+8 A Cc L03 L09+8 I A Dc E5+16 A Dc L03 L10-8 I Ac B E6-8 Ac B L03 L04+16 Ac B L03 L05+8 Ac B L03 L06-8 I Ac C E3-8 Ac C L03 L07+16 Ac C L03 L08+8 Ac C L03 L09-8 I Ac D E5+16 Ac D L03 L10-8 B Bc L01 L02-16 B Bc L04 L05-16 B Bc L04 L06+16 B Bc L05^2+16 B Bc L05 L06+8 I B Cc E2-8 B Cc L04 L08-8 B Cc L04 L09-8 B Cc L05 L07+16 B Cc L05 L08+8 B Cc L05 L09-8 B Cc L06 L07+8 B Cc L06 L08+8 I B Dc E4-8 B Dc L04 L10+16 B Dc L05 L10+8 B Dc L06 L10-8 I Bc C E2-8 Bc C L04 L08-8 Bc C L04 L09-8 Bc C L05 L07+16 Bc C L05 L08+8 Bc C L05 L09-8 Bc C L06 L07+8 Bc C L06 L08-8 I Bc D E4-8 Bc D L04 L10+16 Bc D L05 L10+8 Bc D L06 L10+8 C Cc L01 L12-16 C Cc L07 L08-16 C Cc L07 L09+16 C Cc L08^2+16 C Cc L08 L09-8 I C Dc E1-8 C Dc L07 L10+16 C Dc L08 L10+8 C Dc L09 L10+8 I Cc D E1-8 Cc D L07 L10+16 Cc D L08 L10+8 Cc D L09 L10+8 D Dc L01 L12+16 D Dc L10^2

Hello everyone. I have a very looong expression (obtained by calculating square of the matrix element in Quantum Field Theory) that is rather hard in simplifying. To be clear, all the coefficients L** and E* are reals, I is the imaginary unit. Ac is the complex conjugate of A and so for B,C,D and Bc,Cc,Dc. My task is to regroup this expression so that the combinations like AAc+AcA, ABc+AcB, ... , would be together and form explicit real numbers.

So ideally i want this (A*Bc+B*Ac)*(...)+(A*Cc+C*Ac)*(...)+...

No idea how to deal with this kind of complexity. Tried Simplify, FullSimplify, Expand/Collect. Nothing works. Mathematica groups something and everything else stays in a very wierd form. Applying another technique makes Mathematica group other parts, but expressions that were groupped before ruin apart.

Any idea?

Posted 10 years ago

First I would avoid starting variable names with uppercase letters in Mathematica. This is especially important with E (which is 2.71828...). As far as simplification maybe replacing a with ar + I ai and ac with ar - I ai so that the real (ar, br, cr, dr) and imaginary terms (ai, bi, ci, di) are explicitly stated with

   8 a ac l01 l02 + 16 a ac l03^2 + 8 I a bc e6 - 8 a bc l03 l04 + 
      16 a bc l03 l05 + 8 a bc l03 l06 + 8 I a cc e3 - 8 a cc l03 l07 + 
      16 a cc l03 l08 + 8 a cc l03 l09 + 8 I a dc e5 + 16 a dc l03 l10 - 
      8 I ac b e6 - 8 ac b l03 l04 + 16 ac b l03 l05 + 8 ac b l03 l06 - 
      8 I ac c e3 - 8 ac c l03 l07 + 16 ac c l03 l08 + 8 ac c l03 l09 - 
      8 I ac d e5 + 16 ac d l03 l10 - 8 b bc l01 l02 - 16 b bc l04 l05 - 
      16 b bc l04 l06 + 16 b bc l05^2 + 16 b bc l05 l06 + 8 I b cc e2 - 
      8 b cc l04 l08 - 8 b cc l04 l09 - 8 b cc l05 l07 + 
      16 b cc l05 l08 + 8 b cc l05 l09 - 8 b cc l06 l07 + 
      8 b cc l06 l08 + 8 I b dc e4 - 8 b dc l04 l10 + 16 b dc l05 l10 + 
      8 b dc l06 l10 - 8 I bc c e2 - 8 bc c l04 l08 - 8 bc c l04 l09 - 
      8 bc c l05 l07 + 16 bc c l05 l08 + 8 bc c l05 l09 - 
      8 bc c l06 l07 + 8 bc c l06 l08 - 8 I bc d e4 - 8 bc d l04 l10 + 
      16 bc d l05 l10 + 8 bc d l06 l10 + 8 c cc l01 l12 - 
      16 c cc l07 l08 - 16 c cc l07 l09 + 16 c cc l08^2 + 
      16 c cc l08 l09 - 8 I c dc e1 - 8 c dc l07 l10 + 16 c dc l08 l10 + 
      8 c dc l09 l10 + 8 I cc d e1 - 8 cc d l07 l10 + 16 cc d l08 l10 + 
      8 cc d l09 l10 + 8 d dc l01 l12 + 16 d dc l10^2 /. {a -> ar + ai I,
       ac -> ar - ai I, b -> br + bi I, bc -> br - bi I, c -> cr + ci I, 
      cc -> cr - ci I, d -> dr + di I, dc -> dr - di I}

might be helpful.

And edit: On second thought because you do know the form of the simplification desired, you might try

eq = 8 a ac l01 l02 + 16
 a ac l03^2 + 8 I a bc e6 - 8 a bc l03 l04 + 
   16 a bc l03 l05 + 8 a bc l03 l06 + 8 I a cc e3 - 8 a cc l03 l07 + 
   16 a cc l03 l08 + 8 a cc l03 l09 + 8 I a dc e5 + 16 a dc l03 l10 - 
   8 I ac b e6 - 8 ac b l03 l04 + 16 ac b l03 l05 + 8 ac b l03 l06 - 
   8 I ac c e3 - 8 ac c l03 l07 + 16 ac c l03 l08 + 8 ac c l03 l09 - 
   8 I ac d e5 + 16 ac d l03 l10 - 8 b bc l01 l02 - 16 b bc l04 l05 - 
   16 b bc l04 l06 + 16 b bc l05^2 + 16 b bc l05 l06 + 8 I b cc e2 - 
   8 b cc l04 l08 - 8 b cc l04 l09 - 8 b cc l05 l07 + 
   16 b cc l05 l08 + 8 b cc l05 l09 - 8 b cc l06 l07 + 
   8 b cc l06 l08 + 8 I b dc e4 - 8 b dc l04 l10 + 16 b dc l05 l10 + 
   8 b dc l06 l10 - 8 I bc c e2 - 8 bc c l04 l08 - 8 bc c l04 l09 - 
   8 bc c l05 l07 + 16 bc c l05 l08 + 8 bc c l05 l09 - 
   8 bc c l06 l07 + 8 bc c l06 l08 - 8 I bc d e4 - 8 bc d l04 l10 + 
   16 bc d l05 l10 + 8 bc d l06 l10 + 8 c cc l01 l12 - 
   16 c cc l07 l08 - 16 c cc l07 l09 + 16 c cc l08^2 + 
   16 c cc l08 l09 - 8 I c dc e1 - 8 c dc l07 l10 + 16 c dc l08 l10 + 
   8 c dc l09 l10 + 8 I cc d e1 - 8 cc d l07 l10 + 16 cc d l08 l10 + 
   8 cc d l09 l10 + 8 d dc l01 l12 + 16 d dc l10^2;
Coefficient[eq, a bc]
Coefficient[eq, ac b]

which results in

8 I e6 - 8 l03 l04 + 16 l03 l05 + 8 l03 l06
-8 I e6 - 8 l03 l04 + 16 l03 l05 + 8 l03 l06

which will tell you what the common coefficients will be for a bc and ac b.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract