# Simplifying the expression, given conditions

My goal is to get the answer y1-t1. How to post process the result of this partial equation to get y1-t1? There are conditions given that t1 + t2 =1 and Exp[a]/S=y1 and Exp[b]/S=y2. I tried such as /.t1+t2 -> 1 and Simplify[] function etc. But I couldn't get neat result y1-t1.

 D[-t1  Log[E^a/(E^a + E^b)] - t2  Log[E^b/(E^a + E^b)], a]

• What has y1-t1 to do with the derivative? Jan 27, 2022 at 15:53
• is it possible that y1 and t1 are defined previously in the code and you forgot to put their expressions here?
– user49048
Jan 27, 2022 at 16:43
• y1-t1 is the answer of the partial derivarive by pencel and paper. I hope mathmatica can arrive this y1-t2
– Soon
Jan 27, 2022 at 18:04
• perhaps you want to have a look at the answer I provided with the edit I made. I have to guess what S is, since it is not explained in the OP.
– user49048
Jan 27, 2022 at 18:57

It's not really clear to me what your issue is. The are several things that hinder us from making progress.

1. You don't give the expected result.
2. You don't explain what S is.

In any case, let's start a bit slowly.

You can take the derivative of what you have provided and perform a FullSimplify in the following way

D[-t1 Log[E^a/(E^a + E^b)] - t2 Log[E^b/(E^a + E^b)],
a] // FullSimplify


The result of the above is:

-t1 + (E^a (t1 + t2))/(E^a + E^b)

So, as you can see you have the desired combination t1+t2 without much effort. You can now apply a replacement rule imposing your rule like so:

(D[-t1 Log[E^a/(E^a + E^b)] - t2 Log[E^b/(E^a + E^b)], a] //
FullSimplify) /. t1 + t2 -> 1


This yields:

E^a/(E^a + E^b) - t1

If you can define what S we can proceed somehow, I guess. But the logic is to try FullSimplify and imposing the conditions that you want as rules. If you don't impose said conditions Mathematica cannot know what you want to do.

Edit: if we make a wild guess that S stands for the sum of the exponents, we can proceed in the following manner.

(D[-t1 Log[E^a/(E^a + E^b)] - t2 Log[E^b/(E^a + E^b)], a] //
FullSimplify) /. t1 + t2 -> 1 /. Exp[a] + Exp[b] -> S


which gives

E^a/S - t1

and a final step is

(D[-t1 Log[E^a/(E^a + E^b)] - t2 Log[E^b/(E^a + E^b)], a] //
FullSimplify) /. t1 + t2 -> 1 /. Exp[a] + Exp[b] -> S /.
Exp[a]/S -> y1


giving you:

-t1 + y1

Is this what you wanted?