# Simplify by defining new functions

if I have a formula like

EN[Subscript[\[Rho], 0]] =
T[Subscript[\[Rho], 0]] + Subscript[EN, ee][Subscript[\[Rho], 0]] +     Subscript[EN, Ne][Subscript[\[Rho], 0]]


and I would like to collect the T and EN_Ne Term and define a new function consisting of the sum of those two expression, lets say F[rho], how do I tell Mathematica to do so?

The result should look like:

EN[Subscript[\[Rho], 0]] =
F[Subscript[\[Rho], 0]] + Subscript[EN, ee][Subscript[\[Rho], 0]]


with

F[Subscript[\[Rho], 0]] =
T[Subscript[\[Rho], 0]] +  Subscript[EN, Ne][Subscript[\[Rho], 0]]


It looks like the reverse to expanding.

In general: In a more complicated context, for the formula

log[x^2 - 1] - x*x + x^3 a - x


Mathematica shall collect (x-1) and define it as a new function f wherever possible.

• Try this: EN[Subscript[\[Rho], 0]] = T[Subscript[\[Rho], 0]] + Subscript[EN, ee][Subscript[\[Rho], 0]] + Subscript[EN, Ne][Subscript[\[Rho], 0]] /.T[Subscript[\[Rho], 0]] -> F[Subscript[\[Rho], 0]] - Subscript[EN, Ne][Subscript[\[Rho], 0]] which yields exactly what you want. I should warn you against a heavy use of subscripts. This often gives rise to errors. Further, you define the function in an incorrect way. Check please tutorial/Introduction-Patterns or Menu/Help/WolframDocumentation/Blank. – Alexei Boulbitch Oct 11 '18 at 10:49