This follows a comment I posted earlier, to which I received several responses but which was then closed. I have used Simplify and FullSimplify with Assumptions to reduce down some very complicated solutions of a 4-dim. system of 1st-order linear ordinary differential equations. But to completely simplify them, I need to factor out terms that appear only in parts of the solutions. Stylized example: I want to convert ax+ay+bx+by+cz to (a+b)(x+y)+cz. "Factor" per se does not do this. Is there some other way? (BTW, for what it's worth in case someone else raises this issue in the future: Before it was just suggested, I hadn't tried "Factor" b/c the documentation says it's for polynomials, and my expressions are not those as they're commonly understood - instead, they're linear combinations of hyperbolic functions. I just learned that MMA has a more expansive understanding of "polynomial.")

  • $\begingroup$ Thanks Ulrich for your response. I previously looked into Collect. The problem is that the full expression I'm trying to factor now has about 40 terms, with three blocks each having a different common factor. (And I have others that are longer.) To follow your example would mean I essentially have to do it "by hand" just to formulate the command. In that case, I might as well just copy and paste the blocks one at a time into Factor. This is a very basic form of simplification. Does MMA really not have a way to do it? $\endgroup$
    – Alan
    Oct 5, 2023 at 19:44
  • $\begingroup$ In order to get any help with your problem, you'll need to post a "minimal working example", not excessive long, but clearly showing what it is you want to accomplish. Otherwise, people have to guess at what you're after. $\endgroup$
    – user87932
    Oct 5, 2023 at 20:13
  • $\begingroup$ This is essentially the same as my previous stylized example, but extracting any illustrative sub-part of my actual expression exceeds the character limit for these comments: Consider aCosh[t] + bCosh[t] + cSinh[t]. I want to simplify this to (a+b)Cosh[t]+cSinh[t]. Neither Factor nor "plain" Simplify or FullSimplify will do this. Does this explain what I'm trying to do? $\endgroup$
    – Alan
    Oct 5, 2023 at 21:48
  • $\begingroup$ Here is a "Simplify trick." Simplify[p,q==biggerExp] will do a lot of work trying to find and rearrange to get biggerExp out of p and then will replace that with the shorter q. Example Simplify[a*Cosh[t]+b*Cosh[t]+c*Sinh[t],q==a+b] returns q*Cosh[t]+c*Sinh[t] and then %/.q->(a+b) returns (a+b) Cosh[t]+c Sinh[t] Simplify is aggressive in extracting that longer expression. You just need to claim that a single unused variable is equal to your longer expression. And then replace that var after Simplify is done. Try this. Does it work? Can you see interesting ways to use this? $\endgroup$
    – Bill
    Oct 5, 2023 at 22:01
  • $\begingroup$ expr = a Cosh[t] + b Cosh[t] + c Sinh[t]; expr // Simplify evaluates to your requested form (a + b) Cosh[t] + c Sinh[t] You need either a space or * between terms being multiplied. $\endgroup$
    – Bob Hanlon
    Oct 6, 2023 at 0:34

1 Answer 1



Collect[a x + a y + b x + b y + c z, x + y, FullSimplify]
(*(a + b) (x + y) + c z*)

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.