I want to perform a partial fraction expansion in the variable qp by treating all other variables as constants (some real, others complex). My code, shown below, does not seem to give me anything.

  -((q qp^3 vq (I Abs[wn] + qp v[-1]) (v[-1] - v[1])^2 (-I Abs[wn] + qp v[1]) 
      (wn^2 + q qp v[-1] v[1]) (-wn^2 + qp^2 v[-1] v[1])) / 
    (2 π^2 (q + qp) (-q1 + qp) β (qp - (I wn)/v[-1]) (qp + (I wn)/v[-1]) 
      v[-1]^2 (-I Abs[wn] + q v[-1]) (2 vq v[-1] + π v[-1]^2) 
      (qp - (Sqrt[π] wn)/Sqrt[-v[-1] (2 vq + π v[-1])]) 
      (qp + (Sqrt[π] wn)/Sqrt[-v[-1] (2 vq + π v[-1])]) 
      (qp - (I wn)/v[1])^2 (qp + (I wn)/v[1])^2 v[1]^4 (I Abs[wn] + q v[1]))), 
  • $\begingroup$ I'll look into it next week. I agree this behavior seems weird, not yet sure if it is a bug though. My guess is Apart is thrown off by having algebraics (radicals) present in the input, even though they do not involve the variable of interest. $\endgroup$ – Daniel Lichtblau May 27 '17 at 16:36
  • $\begingroup$ I think it now works to specifications. Gives a fairly large result though. $\endgroup$ – Daniel Lichtblau Apr 2 '18 at 17:45

You could use the APart package by Feng Feng (https://github.com/F-Feng/APart)

<< Apart`

InnerCollectFunction = Identity;

exp = -((q qp^3 vq (I Abs[wn] + 
        qp v[-1]) (v[-1] - v[1])^2 (-I Abs[wn] + qp v[1]) (wn^2 + 
        q qp v[-1] v[1]) (-wn^2 + qp^2 v[-1] v[1]))/(2 \[Pi]^2 (q + 
        qp) (-q1 + 
        qp) \[Beta] (qp - (I wn)/v[-1]) (qp + (I wn)/
         v[-1]) v[-1]^2 (-I Abs[wn] + 
        q v[-1]) (2 vq v[-1] + \[Pi] v[-1]^2) (qp - (Sqrt[\[Pi]] wn)/
         Sqrt[-v[-1] (2 vq + \[Pi] v[-1])]) (qp + (Sqrt[\[Pi]] wn)/
         Sqrt[-v[-1] (2 vq + \[Pi] v[-1])]) (qp - (I wn)/
          v[1])^2 (qp + (I wn)/v[1])^2 v[1]^4 (I Abs[wn] + q v[1])))

ApartAll2[exp_, vars_] := 
 Module[{tmp, VF}, 
  tmp = Distribute[VF[Expand[exp, Alternatives @@ vars]]];
  tmp = tmp /. VF[ex_] :> ApartAll[ex, vars];

AbsoluteTiming[res = ApartAll2[exp, {qp}];]

res // RemoveApart

The evaluation requires less than one 30 seconds. However, one should say that by default APart would also have troubles with this expression. By setting InnerCollectFunction = Identity; we skip the simplification of fairly complicated prefactors and hence can obtain the final result faster.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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