0
$\begingroup$

Consider this expression as rendered by default StandardForm in MMA (my installation, 11.0.1.0, Windows)

expr = ((3*2^Sum[Subscript[q, j], {j, 1, -1 + P}] + 3^P)*(2^Sum[Subscript[q, j], {j, 1, P}] + 3^P) + 3^(1 + 2*P)*n + 
  3*(2^Sum[Subscript[q, j], {j, 1, P}] + 3^P)*Sum[2^Sum[Subscript[q, j], {j, 1, i}]*3^(-i + P), {i, 2, -1 + P}])/
 (3*2^Sum[Subscript[q, j], {j, 1, P}])

When written out (here via TeXForm, which is not quite the same as StandardForm) it is readily apparent that the factor of $1/3$ cancels numerous explicit factors of $3$ and can be absorbed in factors of $3^m$ by the replacement $m \rightarrow m-1$

$\frac{1}{3} 2^{-\sum _{j=1}^P q_j} \left(3 \left(2^{\sum _{j=1}^P q_j}+3^P\right) \left(\sum _{i=2}^{P-1} 3^{P-i} 2^{\sum _{j=1}^i q_j}\right)+\left(3\ 2^{\sum _{j=1}^{P-1} q_j}+3^P\right) \left(2^{\sum _{j=1}^P q_j}+3^P\right)+n 3^{2 P+1}\right)$

The question is, how can I force MMA to make this simplification? Simplify does not do it, FullSimplify times-out.

If I use Expand[expr] I obtain

$3^P 2^{-\sum _{j=1}^P q_j} \sum _{i=2}^{P-1} 3^{P-i} 2^{\sum _{j=1}^i q_j}+\sum _{i=2}^{P-1} 3^{P-i} 2^{\sum _{j=1}^i q_j}+n 3^{2 P} 2^{-\sum _{j=1}^P q_j}+3^P 2^{\sum _{j=1}^{P-1} q_j-\sum _{j=1}^P q_j}+3^{2 P-1} 2^{-\sum _{j=1}^P q_j}+2^{\sum _{j=1}^{P-1} q_j}+3^{P-1}$

and then have factors such as $3^P$ that can/should be factored out again (where they occur in isolation; I would strongly prefer not to have $3^{p-1} \rightarrow 3^P /3$, for example} (Is there a pattern I could supply to Expand to avoid this?)

I suspect this could be done with replacement rules, but I fear the required rules would be rather ad hoc and would much prefer a (simpler) generic solution.

$\endgroup$
2
  • $\begingroup$ Related to getting 3^p out of the sum: (16969), (58091), (226003) -- Another point: 3^p/3 won't stay in that form. $\endgroup$
    – Michael E2
    Oct 18, 2022 at 11:24
  • $\begingroup$ @MichaelE2 Indeed! $3^P/3 \rightarrow 3^{-1+P}$, with leading -1, yet another - but separate - peeve! $\endgroup$ Oct 18, 2022 at 17:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.