Given a function like Conjugate[] acting on a sum, how I can change an expression like

Conjugate[ 6 I Sqrt[2] h1L1Ri Y1L + 6 Sqrt[2] h1L1Rr Y1L + Y15L (3 I Sqrt[2] h15i[3] + I Sqrt[6] h15i[8] + I Sqrt[3] h15i[15] + 3 Sqrt[2] h15r[3] + Sqrt[6] h15r[8] + Sqrt[3] h15r[15])]

to

Conjugate[ 6 I Sqrt[2]] Conjugate[ h1L1Ri] Conjugate[ Y1L] + Conjugate[6 Sqrt[2]] Conjugate[ h1L1Rr ] Conjugate[ Y1L] + Conjugate[ Y15L ] ( Conjugate[3 I Sqrt[2]] Conjugate[ h15i[3]] +…)],

i.e. that now Conjugate[] acts on each object in the sum individually?

=================

=================

2 Answers

2

=================

expr = 6 I Sqrt[2] h1L1Ri Y1L + 6 Sqrt[2] h1L1Rr Y1L +

Y15L (3 I Sqrt[2] h15i[3] + I Sqrt[6] h15i[8] + I Sqrt[3] h15i[15] +

3 Sqrt[2] h15r[3] + Sqrt[6] h15r[8] + Sqrt[3] h15r[15]);

Map[Conjugate, expr, {2}]

If you really want each term, you can expand first

Map[Conjugate, Expand@expr, {2}]

Added:

Thanks to Kuba suggestion, you can also use, for general case

Map[Conjugate, Expand@expr, {-1}]

3

In case of more complex expression OP will probably need Map[Conjugate, expr, {-1}].

– Kuba

Jan 3 at 12:36

@Kuba yes, I forgot above the -1, thanks for point it out. But Expand@expr is still needed as well.

– Nasser

Jan 3 at 22:21

You can be quite flexible using replacement rules such as

rules = {Conjugate[u_Plus]:>Conjugate/@u, Conjugate[u_Times]:>Conjugate/@u}

This is then applied as required, e.g.

expr //. rules