11
$\begingroup$

I have a complicated algebraic expression that involves a lot of similar terms. In particular, I have a complicated sub-expression involving sums and products that I would like to denote $\alpha$. I would like Mathematica to automatically recognize the occurrence of this sub-expression and replace it with $\alpha$.

For example, say I have the expression:

$$\frac{1 + xy(1+x) + zx^2 + (z + 1)y}{x^2y^2(z+2)(x+1)^2}$$

and I know $\alpha = xy(1+x)$. I would like to simplify this to:

$$\frac{1+\alpha+zx^2 + (z + 1)y}{\alpha^2(z+2)}$$

I know there are several ways of performing the simplification. I just want Mathematica to give me a reasonably simplified expression that exploits the equality $\alpha = xy(1+x)$, since using $\alpha$ is shorter than $xy(1+x)$.

Is there a way to do this?

$\endgroup$
3
  • 2
    $\begingroup$ Copy & paste is so much more fun than typing & checking. I guess I'll look for another problem... :) $\endgroup$ Commented Mar 7, 2017 at 15:47
  • 11
    $\begingroup$ Try Simplify, e.g., Simplify[expr, a == x y (1 + x)] $\endgroup$ Commented Mar 7, 2017 at 15:50
  • $\begingroup$ @CarlWoll Thanks! For some reason I had assumed that wouldn't work. If you post an answer I'll accept it. $\endgroup$ Commented Mar 7, 2017 at 15:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.