Ask Your Question

Revision history [back]

Indeed, (pp*A*qq).collect(p) does not work because p now refers to the tuple containing the indexed variables, rather than the original p. So, use a different name for the tuple of indexed variables, like P:

P = var("p", n=10, latex_name='\\overline{p}')
EGe0 = (pp*A*qq).collect(p).subs(p==P[0])
show(EGe0)

Output: $${\left(2 q x + {\left(q - 1\right)} y\right)} {\overline{p}}_{0} - q x$$