2
$\begingroup$

I am doing the contour integration using Mathematica. After extraction of residues, my expression contains a lot of unwanted pairs such as

(I t - u y[2]) (I t + u y[2]) 

or

(t^2 - I u Sqrt[w[1]]) (t^2 + I u Sqrt[w[1]]).

I want them to be combined so that $i$'s should be no longer involved in the expression. Any suggestions?

added: Maybe I should write down the (part of) real example which I want to reduce.

Simplify[((I Sqrt[t/u] - y[1]) (I Sqrt[t/u] + y[1]) (-1 + 
  I Sqrt[t/u] y[1]) (1 + I Sqrt[t/u] y[1]) (1 + 
  y[1]^2) (I Sqrt[t/u] - y[2]) (I Sqrt[t/u] + y[2]) (-1 + 
  I Sqrt[t/u] y[2]) (1 + I Sqrt[t/u] y[2]) (1 + 
  y[2]^2) (I Sqrt[t/u] - y[3]) (I Sqrt[t/u] + y[3]) (-1 + 
  I Sqrt[t/u] y[3]) (1 + I Sqrt[t/u] y[3]) (1 + 
  y[3]^2) (I Sqrt[t/u] - y[4]) (I Sqrt[t/u] + y[4]) (-1 + 
  I Sqrt[t/u] y[4]) (1 + I Sqrt[t/u] y[4]) (1 + 
  y[4]^2) (I Sqrt[t/u] - y[5]) (I Sqrt[t/u] + y[5]) (-1 + 
  I Sqrt[t/u] y[5]) (1 + I Sqrt[t/u] y[5]) (1 + 
  y[5]^2) (I Sqrt[t/u] - y[6]) (I Sqrt[t/u] + y[6]) (-1 + 
  I Sqrt[t/u] y[6]) (1 + I Sqrt[t/u] y[6]) (1 + 
  y[6]^2))/(2  (-I Sqrt[t/u] + t Sqrt[w[1]]) (I Sqrt[t/u] + 
  t Sqrt[w[1]]) (t^2 + w[1]) (1 + t^2 w[1]) (Sqrt[u] - 
  I Sqrt[t^3 w[1]]) (Sqrt[u] + I Sqrt[t^3 w[1]]) (-I t + Sqrt[(
  t w[1])/u]) (I t + Sqrt[(t w[1])/u]) (t^(3/2) - 
  I Sqrt[u w[1]]) (t^(3/2) + I Sqrt[u w[1]]))]
$\endgroup$
3
  • $\begingroup$ How about FullSimplify[(I t - u y[2]) (I t + u y[2])]? $\endgroup$
    – bill s
    Commented Dec 24, 2013 at 2:39
  • $\begingroup$ It does not work. In addition, I want to avoid using `FullSimplify' since it would take a huge amount of time. (I am dealing with a large expressions, which must be real and rational, after resolving strange square roots and $i$'s.) $\endgroup$
    – Joonho Kim
    Commented Dec 24, 2013 at 2:42
  • 1
    $\begingroup$ It does work, you just need to apply FullSimplify to the appropriate parts of the equation and not to the whole thing all at once. For example, if your whole expression is h, then FullSimplify[Numerator[h][[{3, 4}]]] simplifies one small part of it. $\endgroup$
    – bill s
    Commented Dec 24, 2013 at 2:55

1 Answer 1

2
$\begingroup$

Here's something to get you started. Let h be the expression above (without the simplify). Then the numerator of h is:

numh = Numerator[h]

You want to apply the FullSimplify to those parts that contain I, so locate these parts:

parts = Partition[Position[numh, I][[All, 1]], 2]
{{1, 2}, {3, 4}, {6, 7}, {8, 9}, {11, 12}, {13, 14}, {16, 17}, {18, 19}, 
 {21, 22}, {23, 24}, {26, 27}, {28, 29}}

which is a list of those parts that come in complex conjugate pairs. So now we want to simplify the various pieces:

FullSimplify[numh[[#]]] & /@ parts
{-((t + u y[1]^2)/u), -((u + t y[1]^2)/u), -((t + u y[2]^2)/u), -((u + t y[2]^2)/u), 
 -((t + u y[3]^2)/u), -((u + t y[3]^2)/u), -(( t + u y[4]^2)/u), -((u + t y[4]^2)/u), 
 -((t + u y[5]^2)/u), -(( u + t y[5]^2)/u), -((t + u y[6]^2)/u), -((u + t y[6]^2)/u)}

which gives all the conjugate pairs simplified. Then you will need to multiply them all together to get the simplified form (don't forget to also retain the parts of the numerator that did not have the complex conjugate form). Then do the analogous processing for the denominator.

Since this only works on the small pieces (rather than the whole expression at once), FullSimplify will not be slow.

$\endgroup$
1
  • $\begingroup$ Thanks a lot. Conjugate pairs are always sequentially arranged and your solution works very efficiently! $\endgroup$
    – Joonho Kim
    Commented Dec 24, 2013 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.