Message Boards Message Boards

How to factor out a more complicated expression?

Posted 9 years ago
Posted 9 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