I have a complicated expression, which among other things has stuff like functions of rational functions:

expr = f[x/(-x^2 + y)] + f[-(x/(x^2 - y))] (* + ...*)

If you apply Simplify to the whole expression, they combine, which is what I ultimately want to achieve:


(* 2 f[-(x/(x^2 - y))] ... *)

However, my complicated expression is so complicated, I prefer not to apply any top-level functions on the entire thing, since it will take a lot of time.

My solution to this problem is to map these top-level functions to the arguments of f like so,

expr /. f[x_] :> f[Simplify[x]]

in the hopes of making the fractions look the same so that they combine. But it doesn't work. Is there another way to achieve this task? (putting these fractions in canonical form, etc.)

  • $\begingroup$ expr /. f[x_] :> f[Factor[x]] works for the example provided. $\endgroup$ – Marius Ladegård Meyer Jun 11 '16 at 10:35
  • 1
    $\begingroup$ You could use Together[] for this. $\endgroup$ – J. M. is in limbo Jun 11 '16 at 11:43
  • $\begingroup$ @MariusLadegårdMeyer Thanks, but Factor doesn't work for -(x/(a^2 - x)) and x/(-a^2 + x) $\endgroup$ – QuantumDot Jun 11 '16 at 14:54
  • 2
    $\begingroup$ @J.M. So here's what I came up with: f[x_?(Internal`RationalFunctionQ[#, Reduce`FreeVariables[#]] &)] :> f[Together@Apart@x] Is that what you had in mind. Quite a lot of undocumented functions there... $\endgroup$ – QuantumDot Jun 11 '16 at 18:25
  • 1
    $\begingroup$ @QuantumDot I think you are looking for the Factor2.m file in the "general" folder of the compressed file you get when you download the latest version of FeynCalc. $\endgroup$ – MarcoB Jun 12 '16 at 20:07

Your Answer

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

Browse other questions tagged or ask your own question.