# Simplifying just parts of an expression

I'm having trouble with the simplifications of certain expressions.
A typical example of this is the following (all my variables are positive real numbers):

k1 = Exp[-t1/al];
et2 = 1 + Exp[-t6/al];
xi2 = 1 + Exp[-t6/al] + Exp[-(t4 + t6)/al];
Log[k1] Log[et2/xi2]


This produces

$$\log\left(e^{-t1/\alpha}\right) \log\left(\dfrac{1+e^{-t6/\alpha}}{1+e^{-(t4+t6)/\alpha} + e^{-t6/\alpha}}\right)$$

Now, I want to get rid of that trivial $\log(\exp)$, so I used Simplify

Simplify[%, Element[{t1, t4, t6, al}, Reals] && al != 0]


which gives

$$-\dfrac{t1}{\alpha}\log\left(\dfrac{e^{t4/\alpha}(1+e^{t6/\alpha})}{ 1 + e^{t4/\alpha}+e^{(t4 + t6)/\alpha}}\right)$$

This is right, of course, but unfortunately it produces an undesired effect: inside the second logarithm, Mathematica has factored $e^{-t4/\alpha}$ and $e^{-(t4+t6)/\alpha}$, turning negative powers in positive ones.
At the end of the day, I will let $\alpha\to0$, so really I'm more comfortable with negative powers of $e$ (it is apparent which terms will be negligible in the limit).

How can I tell Mathematica not to touch the argument of the second logarithm?

• If You want Simplify to simplify only the first part (first logarithm) You can try Simplify[%[], Element[{t1, t4, t6, al}, Reals] && al != 0]*%[]. Jan 20 '14 at 15:51
• Yeah, that could work just fine. The example above is just a single term in a sum of five pieces, each one of which gives the same problem, but I could always select the various contributions with [[...]]. Jan 20 '14 at 16:00
• You might find helpful PowerExpand, see e.g. here How can I simplify log(512) to 9log(2)? Jan 20 '14 at 18:02

In general one can use MapAt to apply the operator to the specified part of expression. In your case, however, this

  Log[E^(-(t1/al))] Log[(1 + E^(-(t6/al)))/(
1 + E^((-t4 - t6)/al) + E^(-(t6/al)))] /. Log[Exp[Z_]] -> Z

(* -((t1 Log[(1 + E^(-(t6/al)))/(
1 + E^((-t4 - t6)/al) + E^(-(t6/al)))])/al) *)


is simpler.

As Alexei Boulbitch said, you can use MapAt to direct Simplify to the desired subexpression. This always requires some extra mental effort though to figure out what is the index of the part you are interested in. It is sometimes more practical to just select the subexpression you want changed and use the Algebraic Manipulation palette, which you will find in the Palettes menu.

It's convenient to use the \$Assumptions variable to set up the assumptions permanently, as you can't specify any when you use the palette. Just use the mouse to select the subexpression you wish to simplify and click the Simplify button. The subexpression will be replaced with the simplified version.

Refine seems more appropriate than Simplify. Replacing your Simplify with Refine seems to deliver the result you want

Refine[Log[k1] Log[et2/xi2], Element[{t1, t4, t6, al}, Reals] && al != 0]


Refine just tries to apply the assumptions without transforming the expression too much. There are no guarantees, and a manual approach may be necessary, but at least in this case it seems to work

• A strange thing: this: Simplify[Log[E^(-(t1/al))], Element[{t1, al}, Reals] && al != 0] yields a right answer. The same with Refine. And this: Simplify[Log[E^(-(t1/al))], {t1 [Element] Reals, a1 [Element] Reals && al != 0}] does not both for the Simplify and for Refine. But these two formulations are equally legal. Am I missing something? Jan 21 '14 at 9:53
• @AlexeiBoulbitch I think the assumptions should be combined with logical operations, and not as a list. Try joining them with &&
– Rojo
Jan 21 '14 at 16:26
• No this: Simplify[Log[E^(-(t1/al))], {t1 [Element] Reals && a1 [Element] Reals &&al != 0}] does not work either. Besides, in all other cases Simplify perfectly works when the assumptions are separated by the mere comma. Jan 22 '14 at 8:07
• @AlexeiBoulbitch I hope it's not because you are using a1 in one place and al on the other?
– Rojo
Jan 22 '14 at 8:30
• Yes, you are right, I mixed a1 with al, but no, it does not work after correction of this mistake. Jan 23 '14 at 9:32

For your specific question, if you just want to use Simplify the way you did here, another route is to Hold the part of the expression you don't wish to alter:

Simplify[Log[E^(-(t1/al))] Hold[Log[(1 + E^(-(t6/al)))/(1 + E^((-t4 - t6)/al) + E^(-(t6/al)))]],
Element[{t1, t4, t6, al}, Reals] && al != 0] // ReleaseHold