# Bringing rational functions to canonical form

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:

Simplify[expr]

(* 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.)

• expr /. f[x_] :> f[Factor[x]] works for the example provided. – Marius Ladegård Meyer Jun 11 '16 at 10:35
• You could use Together[] for this. – J. M. is away Jun 11 '16 at 11:43
• @MariusLadegårdMeyer Thanks, but Factor doesn't work for -(x/(a^2 - x)) and x/(-a^2 + x) – QuantumDot Jun 11 '16 at 14:54
• @J.M. So here's what I came up with: f[x_?(InternalRationalFunctionQ[#, ReduceFreeVariables[#]] &)] :> f[Together@Apart@x] Is that what you had in mind. Quite a lot of undocumented functions there... – QuantumDot Jun 11 '16 at 18:25
• @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. – MarcoB Jun 12 '16 at 20:07