# on simplifying an expression

After some integration process, I ended up with the following expression:

(1/(b (-1 + E^b) Re[b]))E^-Re[b](  b E^b - b + E^Re[b] Re[b] - E^(b + Re[b]) Re[b]
+ E^Re[b] Sqrt[E^(-2 b) (-1 + E^b)^2] Re[b]
+ b E^(b + Re[b]) Sqrt[E^(-2b)(-1 + E^b)^2] Re[b] )


all is good, but this expression is supposed to be equal to

1 + (2/b) e^(-b) - 1/b


via simple numerical trials, i can confirm that they are equal. But, it would be great if I can actually make Mathematica simplify that nasty expression into this innocent form. I tried, Fullsimplify, it does not work. Does anyone have any suggestion?

-
Use //ComplexExpand//PowerExpand//Simplify (I suppose b is Real, if not, dont use the ComplexExpand part) – Spawn1701D Apr 14 '13 at 0:08
Using Simplify[PowerExpand[%]] worked. Thank you. I did not know that this was more powerful than FullSimplify. I appreciate your help. – Korben Dallas Apr 14 '13 at 0:24
Perhaps you should declare b as a real (using the option Assumptions) in your integration process. it might save you some time. – Spawn1701D Apr 14 '13 at 7:28

Algebraic simplifications like Simplify and FullSimplify can be used with the second argument - assumptions. We can assume e.g. that b is a real number i.e. b ∈ Reals (otherwise the system assumes that b is complex) :

Simplify[ (1/(b (-1 + E^b) Re[b])) E^-Re[b](-b + b E^b + E^Re[b] Re[b]
- E^(b + Re[b]) Re[b] + E^Re[b] Sqrt[E^(-2 b) (-1 + E^b)^2] Re[b]
+ b E^(b + Re[b]) Sqrt[E^(-2 b) (-1 + E^b)^2] Re[b]),  b ∈ Reals] //


Since there are two cases b >= 0 and b < 0 (in general there might be more cases depending on the assumptions) we should map Expand on the output ( common shorthands Map -- /@ and MapAll -- //@)

Expand //@ % // TraditionalForm


The same answer you can get with FullSimplify.

-
Thank you very much @ Artes. Much obliged! – Korben Dallas Apr 14 '13 at 0:27

The expression you gave simplifies to the form you are looking for only for positive and real $b$. Just give this assumption in Simplify:

In[14]:= Simplify[expr, b > 0]
Out[14]= (E^-b (2 + (-1 + b) E^b))/b

In[15]:= Expand[%]
Out[15]= 1 - 1/b + (2 E^-b)/b

-
thank you @ Szabolcs. You are absolutely right, b is real. – Korben Dallas Apr 14 '13 at 0:35