Is it possible to simplify the expression using user-defined functions? For example if I define:

m[l_, x_] := Sum[x^i/i, {i, 1, l - 1}]

I would like

x + x^2/2 // FullSimplify

to returns

m[3, x]

1 Answer 1


You can use the second argument of FullSimplify to specify (hopefully not too long) a list of equalities involving the forms that you wish to detect and keep in the input expression:

m[l_, x_] := Sum[x^i / i, {i, 1, l-1}]

FullSimplify[10 + x + x^2/2, Array[m[#, x] == HoldForm[m[#, x]] &, 10]]

10 + m[3, x]

FullSimplify[5 + x + 5 (x + x^2/2) + y Log[x + x^2/2 + x^3/3], 
   Array[m[#, x] == HoldForm[m[#, x]] &, 10]]

5 + m[2, x]+ 5 m[3, x] + y Log[m[4, x]]


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.