My question is quite a simple one, but I have not been able to find a solution yet. Say I have terms of the form e.g
where the ni are just symbols. I want to replace these two terms as follows.
I find that in some cases Mathematica will do it, but in some cases it will give me expressions like replacing the latter term as n5*a, etc. rather than just b as indicated. The replacement works how I like it to if I order the replacements in the right way within the brackets. Is there a way to make this automatic? I am dealing with many of these terms so to order appropriately would be tiresome.