S x;
CF f;
L F = 1 + x + x^2;
multiply f(count_(x,1));
P;
.end
The intention is that count_ would get the power counting of x for each term in the expression F so that the result would be F = f(0) + f(1)*x + f(2)*x^2. But this could be wrong because count_ may be evaluated in the argument of f. Then count_ get replaced with 0 because there is no x in the argument. The result should be F = f(0) + f(0)*x + f(0)*x^2.
Now the problem is: both expectations are wrong. One gets
FORM 4.1 (Jan 21 2017, v4.1-20131025-294-g43ddc01) 64-bits Run: Wed Feb 1 16:16:03 2017
F =
f(1) + f(1)*x + f(1)*x^2;
Sounds like somehow count_ gets 1. What is the origin of this behaviour?
By the way, the intended result can be obtained by putting it into a $-variable:
S x;
CF f;
L F = 1 + x + x^2;
$x = f(count_(x,1));
multiply $x;
P;
.end
giving
FORM 4.1 (Jan 21 2017, v4.1-20131025-294-g43ddc01) 64-bits Run: Wed Feb 1 16:20:06 2017
F =
f(0) + f(1)*x + f(2)*x^2;
Consider the following example:
The intention is that
count_
would get the power counting ofx
for each term in the expressionF
so that the result would beF = f(0) + f(1)*x + f(2)*x^2
. But this could be wrong becausecount_
may be evaluated in the argument off
. Thencount_
get replaced with 0 because there is nox
in the argument. The result should beF = f(0) + f(0)*x + f(0)*x^2
.Now the problem is: both expectations are wrong. One gets
Sounds like somehow
count_
gets 1. What is the origin of this behaviour?By the way, the intended result can be obtained by putting it into a $-variable:
giving