Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

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

in Bug reports by (2.1k points)

1 Answer

+1 vote
 
Best answer

You smash a bug and it appears somewhere else... This one was caused by fixing a related issue just after X-mas (I blame Santa). Hopefully it is now finally gone. Pushed a fix to the devel branch. Thanks for reporting this!

by (85.9k points)
selected by
execution problems

Hi Kasper,

I'm now able to run version 2.5.11 from the devel branch but I'm still getting the same incorrect results.

Cheers, Leo

Can you double-check that? I have literally copied your test cases into tests/substitute.cdb and they all pass for me.

Hi Kasper,

I can now confirm that version 2.5.10 does fix this problem. Many thanks.

Cheers, Leo

...