I am running symbolic calculations with Mathematica. Simplification of algebraic expressions is an important part of them as very often final results can be simplified considerably. Typically my expressions involve many variables that can be categorised into few groups. I use to denote a group by a letter, variables within the group are distinguished by an index, e.g. $A_1$, $B_2$, etc. At some point I found out (and tried to discuss it here Simplifying using assumptions) that FullSimplify command best works with variables without any subscripts. In the example below the result of the simplification is cardinally different depending whether I am using plain letters
$-\frac{p}{a+x}+\frac{q}{x-a}+\frac{P}{b+x}+\frac{Q}{b-x}$
or letters with subscripts
$\frac{B_1 \left(a_1+x\right) \left(A_2 \left(a_2-x\right) \left(-a_1+a_2+2 x\right)-\left(a_1-a_2\right) B_2 \left(a_2+x\right)\right)-A_1 \left(a_1-x\right) \left(\left(a_1-a_2\right) A_2 \left(a_2-x\right)+B_2 \left(a_1-a_2+2 x\right) \left(a_2+x\right)\right)}{\left(x-a_1\right) \left(a_1+x\right) \left(a_2-x\right) \left(a_2+x\right)}$.
Clearly, I prefer the first form. Therefore I am using rules to replace indexed variables with plain letters, perform a simplification, and using the rules again to replace plain letters by the original indexed variables. However, it is not very convenient method, also in view of the fact that the number of letters is finite...
Therefore I have a question, is there a way to teach FullSimplify to work as efficiently with indexed variables as it does with the normal ones?
Below are two equivalent expressions. The first one contains only letters
f2 = (-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) + q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b - x) (-a + x) (a + x) (b + x));
rule2 = {(p + q) -> 1, (P + Q) -> 1};
FullSimplify[f2] /. rule2
It leads to the first equation. The second one
f1 = ((x + Subscript[a,1]) Subscript[B,1]((-x + Subscript[a, 2])(2 x - Subscript[a,1] + Subscript[a,2]) Subscript[A,2]-(Subscript[a,1]-Subscript[a, 2]) (x + Subscript[a,2]) Subscript[B,2]) - (-x + Subscript[a,1]) Subscript[A,1] ((Subscript[a, 1] - Subscript[a,2]) (-x + Subscript[a,2]) Subscript[A,2] + (2 x + Subscript[a, 1] - Subscript[a, 2]) (x + Subscript[a,2]) Subscript[B,2]))/((x - Subscript[a,1]) (x + Subscript[a,1]) (-x + Subscript[a, 2]) (x + Subscript[a, 2]));
rule1 = {Subscript[A,1] + Subscript[B,1] -> 1, Subscript[A,2] + Subscript[B,2] -> 1};
FullSimplify[f1] /. rule1
Is equivalent to the first one, however, it is returned unsimplified (at least with my version of Mathematica: 9.0.1 for Mac OS X). Two expressions are equivalent as the following command shows
FullSimplify[f1 - f2 /. {Subscript[a,1] -> a, Subscript[a,2] -> b, Subscript[A,1] -> p, Subscript[A,2] -> P, Subscript[B,1] -> q,Subscript[B,2] -> Q}]
Returns 0.
Thank you in advance.
a1
,a2
,a3
...b1
,b2
, ...,z1
,z2
, ...aa1
,...ab1
...? You have an infinite pool of symbols! $\endgroup$