5
$\begingroup$

Some time ago, our community generally believed that one should avoid operating indexed variables such as Subscript[a,1]. I remember to have several times adviced somebody to use a1 instead. Indeed, in the past, I noticed that algebraic calculations with indexed variables sometimes return erroneous results.

However, times are changing. Presently, the results of the indexed algebra seem to be correct.

On the other hand, calculations with indexed variables are very convenient for those who make vector and tensor calculus. The convenience is in the closeness of such an indexed notation to the traditional indexed tensor notation. In this case, it is easier to see the results. For this reason, they are less prone to errors.

My questions: Did you still notice errors in any symbolic operations with indexed variables? Do you know other pitfalls related to them? Could you kindly give examples? Do you know the reasons for these errors, if any?

Edit: From the response of @yarchik one can see that he can expect problems with simplification. Discussion here shows that it is most probably due to the fact that the TreeForm of the indexed variable already exhibits several leaves. As the result, the LeafCountgives a different result with respect to the plane one.

Then the next question pops up: Is simplification the only problem showing up with the indexed variables? Can other then Simplify operations give errors when performed with the indexed variables?

$\endgroup$
4
$\begingroup$

I have MA 11 and the problem still persist. Consider the following simplification that works for unsubscripted variables

f1=(-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));
rule1={(p+q)->1,(P+Q)->1};
FullSimplify[f1]/.rule1

$$\frac{Q}{b-x}+\frac{q}{x-a}-\frac{p}{a+x}+\frac{P}{b+x}$$

Now replace the variables with subscripted ones

notations={a->Subscript[x,1],b-> Subscript[x,2],
           p->Subscript[y,1],P-> Subscript[y,2],
           q-> Subscript[z,1],Q->Subscript[z,2]};
f2=f1/.notations;
rule2=rule1/.notations;

FullSimplify[f2]/.rule2

The expression is returned unsimplified.

$\endgroup$
  • $\begingroup$ Thank you. In this relation there is an important question. Is it only the problem that some expressions do not simplify to the desired extent? Or the problem is deeper and Mma sometimes introduces errors when making operations? $\endgroup$ – Alexei Boulbitch Feb 11 '20 at 12:04
  • $\begingroup$ @AlexeiBoulbitch The expression does not simplify to the desired extent if Subscript is used. But one may also ask about the origin of this effect. Probably the answer is hidden somewhere deep in FullSimplify. $\endgroup$ – yarchik Feb 11 '20 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.