# Factoring out parts of an expression

I'm looking to factor out the parts of a multiplication type of expression. For example for the expression:

$$20 e^{-t^2}\frac{t^2}{\sqrt{t^2+a}} erf(b+t)$$

I'd like to get a list in the form of: $$\left\{ 20, \left\{t^2,\frac{1}{\sqrt{t^2+a}}, e^{-t^2}, erf(b+t) \right\} \right\}$$

Where only t is defined as a variable.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey May 7 '15 at 19:39

Given

expression = (20*t^2*Erf[b + t])/(E^t^2*Sqrt[a + t^2]) can be achieved via replacement of the Head

List @@ expression To find constant factors:

GatherBy[List @@ expression, NumberQ] It is so because Times here is single Head for all first-level factors:

TreeForm[expression] This also can prove to be useful:

FactorList[expression] • Okay, how do I group all the constants that do not depend on t into a single expression? – user1581390 May 7 '15 at 19:53
• @user1581390 Do you mean go back? Not sure I understand. – Vitaliy Kaurov May 7 '15 at 19:54
• I mean if the expression was $4 a b t$ I'd like to single out the constant part, in this case $4 a b$, because a and b do not depend on t. – user1581390 May 7 '15 at 19:59
• @user1581390 I added an example above. – Vitaliy Kaurov May 7 '15 at 20:34