# Divide this expression into three specified parts, each of which is simple to the simplest

I have some long expressions like exp which can be divided into three specified part. I want to simplify each part to its simplest one use FullSimplify.

The specified parts should be:

1. the first part is term1 = factor1 * E^(-(t/τe1)),
2. the second part is term2 = factor2 * DiracDelta[t],
3. the third part is term3 = factor3.

Here factor1, factor2, and factor3 shold not have E^(-(t/τe1)) or DiracDelta[t].

The one long expression is like this

exp = 1/(16 π (-1 + δ)) (1 +
2 (1/(9 η0^2 (λ0 + μ0)^4) E^(-(t/τe1)) μ0^2 (-(3
λ0 + 2 μ0) (6 η0 (λ0 + μ0) (λ0 +2 μ0) -
t μ0^2 (3 λ0 + 2 μ0)) -
x (6 η0 λ0 (λ0 + μ0) +
t μ0^2 (3 λ0 + 2 μ0))) + ((λ0 +
2 μ0) (x + λ0 + 2 μ0) DiracDelta[
t])/(λ0 + μ0)^2 -
3 (-((E^(-(t/τe1)) μ0^2 (3 λ0 +
2 μ0))/(3 η0 (λ0 + μ0)^2)) + ((λ0 +
2 μ0) DiracDelta[t])/(λ0 + μ0))))


I know firstly I should Expand it into some terms, then divide these terms into three part, then use FullSimplify to simplify them.

But I don't know how to use MatchQ to get these three specified parts.

Thank you very much!

Edit 2017/05/27

The exp without synatix error is like this:

exp=(1 + 2 ((E^(-(
t/\[Tau]e1)) \[Mu]0^2 ((-3 \[Lambda]0 -
2 \[Mu]0) (6 \[Eta]0 (\[Lambda]0 + \[Mu]0) (\[Lambda]0 +
2 \[Mu]0) - t \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0)) -
x (6 \[Eta]0 \[Lambda]0 (\[Lambda]0 + \[Mu]0) +
t \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0))))/(
9 \[Eta]0^2 (\[Lambda]0 + \[Mu]0)^4) + ((\[Lambda]0 +
2 \[Mu]0) (x + \[Lambda]0 + 2 \[Mu]0) DiracDelta[
t])/(\[Lambda]0 + \[Mu]0)^2 -
3 (-((E^(-(t/\[Tau]e1)) \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0))/(
3 \[Eta]0 (\[Lambda]0 + \[Mu]0)^2)) + ((\[Lambda]0 +
2 \[Mu]0) DiracDelta[
t])/(\[Lambda]0 + \[Mu]0))))/(16 \[Pi] (-1 + \[Delta]))


After using exp2=Collect[exp, {DiracDelta[t], Exp[-\[Tau]/\[Tau]e1]}, Simplify], I get

exp2=(E^(-(t/\[Tau]e1)) (9 E^(
t/\[Tau]e1) \[Eta]0^2 (\[Lambda]0 + \[Mu]0)^4 -
2 \[Mu]0^2 (x (6 \[Eta]0 \[Lambda]0 (\[Lambda]0 + \[Mu]0) +
t \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0)) - (3 \[Lambda]0 +
2 \[Mu]0) (t \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0) +
3 \[Eta]0 (\[Lambda]0^2 - \[Mu]0^2)))))/( 144 \[Pi] (-1 + \[Delta]) \[Eta]0^2 (\[Lambda]0 + \[Mu]0)^4) + ((x -
2 \[Lambda]0 - \[Mu]0) (\[Lambda]0 + 2 \[Mu]0) DiracDelta[t])/( 8 \[Pi] (-1 + \[Delta]) (\[Lambda]0 + \[Mu]0)^2)


Its return is very close to the answer I want. But exp2 has two terms, not three. The first term of exp2 contains E^(-(t/\[Tau]e1)) (temp1*(E^(t/\[Tau]e1)+temp2).

If I try Collect[Part[%, 1], Exp[-\[Tau]/\[Tau]e1], Simplify] on the first term, then MMA just return it without change.

Could you help me to get three terms? I have about 50 long expressions like exp1, So I need a function to do this work. Thank you!

• Your expression was not posted correctly. I tried to fix the formatting but there are syntax errors so will not evaluate. Would you please try again? never mind, I think bbgodfrey fixed it. May 26 '17 at 15:48
• Both @Mr.Wizard and I tried to fix the many formatting errors, and I think we got them all. In any case, use Collect[exp, {Exp[-(t/τe1)], DiracDelta[t]}, Simplify]. May 26 '17 at 15:50
• @Mr.Wizard I have edited my question, thank you very much! May 27 '17 at 0:46
• @bbgodfrey I try your code, then I get two terms, not three terms. I try to use Collect[Part[%,1], Exp[-(t/τe1)], Simplify ] on the first term to divide it into two, but it doesn't work. May 27 '17 at 0:50
• @tanghe2014 I obtain three terms when applying Collect to exp in your edit. May 27 '17 at 0:52

T0 make my comment more concrete, use

Collect[exp, {Exp[-t/τe1], DiracDelta[t]}, Simplify]


to obtain

1/(16 π (-1 + δ)) +
(E^(-(t/τe1)) μ0^2 (-x (6 η0 λ0 (λ0 + μ0) + t μ0^2 (3 λ0 + 2 μ0)) + (3 λ0 + 2 μ0)
(t μ0^2 (3 λ0 + 2 μ0) + 3 η0 (λ0^2 - μ0^2))))/(72 π (-1 + δ) η0^2 (λ0 + μ0)^4) +
((x - 2 λ0 - μ0) (λ0 + 2 μ0) DiracDelta[t])/(8 π (-1 + δ) (λ0 + μ0)^2)


In general, Collect with Simplify can be used to gather together and simplify the coefficients of various subexpressions in larger expressions.

• Thanks, Collect[exp, {Exp[-t/τe1], DiracDelta[t]}, Simplify], then get (1/(144 \[Pi] (-1 + \[Delta]) \[Eta]0^2 (\[Lambda]0 + \[Mu]0)^4)) E^(-(t/\[Tau]e1)) (9 E^(t/\[Tau]e1) \[Eta]0^2 (\[Lambda]0 + \[Mu]0)^4 + 2 \[Mu]0^2 (-x (6 \[Eta]0 \[Lambda]0 (\[Lambda]0 + \[Mu]0) + t \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0)) + (3 \[Lambda]0 + 2 \[Mu]0) (3 \[Eta]0 (\[Lambda]0 - \[Mu]0) (\[Lambda]0 + \ \[Mu]0) + t \[Mu]0^2 (3 \[Lambda]0 + 2 \[Mu]0)))) + ((x - 2 \[Lambda]0 - \[Mu]0) (\[Lambda]0 + 2 \[Mu]0) DiracDelta[t])/( 8 \[Pi] (-1 + \[Delta]) (\[Lambda]0 + \[Mu]0)^2) May 27 '17 at 0:41
• I get two terms not three terms. It is very close to the answer I want. How to get three terms? Thank you! May 27 '17 at 0:45
• @tanghe2014 I cannot obtain the expression in your comment just above. May 27 '17 at 0:57
• Sorry for my post. If add Expand on exp in your code, It will return what we want. May 27 '17 at 1:42

Following the comment, I find this code works well!

intoThreeTerms[exp_]:=Collect[
exp // Expand,
{Exp[t/\[Tau]e1], DiracDelta[t]},
FullSimplify];
myexp2=intoThreeTerms[myexp1]