1

If I want to replace, say, a with a1 + a2 in an expression, I can write

expr /. a -> a1 + a2

But what about the opposite?

In some cases it might just be a matter of inverting things, such as the following substitutions

$\qquad \phi=\varphi_{1}+\varphi_{2},\quad \delta=\varphi_{1}-\varphi_{2}$

which can be inverted by solving for $\varphi_1,\, \varphi_2$ and then just using /.

But what about something more complex like this:

Sin[a + c] + Sin[c](Cos[b + c]a + Sin[Cos[a + c] + a*b]) + Log[a + b + c]

Let's say that I want to replace every instance of the expression a + b + c with S, and leave unchanged all the other expressions in which a, b or c appear but not in the form a + b + c.

How should I do this?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
usumdelphini
  • 996
  • 4
  • 14

0 Answers0