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

Greetings, I'm trying to use the substitute algorithm to set the value of a scalar expression but I'm getting some very odd results. In the following examples I set a variable s to be 1 and the expected result should be zero. But in the first case I get 2. This problem only seems to arise for the single choice of s=1. Cheers, Leo

# ----------------------------------------------------
# fails, should return 0

foo := s - s**3;

substitute (foo, $s = 1$);

# ----------------------------------------------------
# success

foo := s - s*s*s;

substitute (foo, $s = 1$);

# ----------------------------------------------------
# success

foo := s**3 - s;

substitute (foo, $s = 1$);

# ----------------------------------------------------
# success

foo := s - s**3;

substitute (foo, $s = 2$);

# ----------------------------------------------------
# success

foo := s - s**3;

substitute (foo, $s = 1/2$);
in Bug reports by (1.8k points)

1 Answer

+1 vote
 
Best answer

Good catch, stupid error, now fixed.

by (82.6k points)
selected by

Hi Kasper, Many thanks for the quick fix. Cheeers, Leo

...