Greetings,
Here is an interesting case.
This short code
tmp := 2 A B + 3 B C + 4 C D.
substitute (tmp, $A? -> \theta A?$)
collect_factors (tmp)
returns
tmp := 2 \theta^2 A B + 3 \theta^2 B C + 4 \theta^2 C D
while
tmp := 2 A B C + 3 B C D + 4 C D E.
substitute (tmp, $A? -> \theta A?$)
collect_factors (tmp)
returns
tmp := 2 \theta^3 A B C + 3 \theta^3 B C D + 4 \theta^3 C D E
Okay, so far , so good.
However, this code
tmp := 2 A + 3 B + 4 C.
substitute (tmp, $A? -> \theta A?$)
returns
tmp := 4 \theta A + 9 \theta B + 16 \theta C
Notice that the integer coefficients have been squared! That's not correct.
Quite interesting, n'est pas?
Cheers,
Leo