The function should be evaluating at j=1
but I am getting j
in the final output as a variable
I have the following function:
g [j_, k_] := Sum[Sum[Binomial[j, μ] Binomial[k, ν] ((1/2)^(j + k) (-1)^(ν + Floor[1/2 k]) B[k])/((β τ + 1)^2 + φ^2 (j + k - 2 μ - 2 ν)^2), {ν, 0,k}], {μ, 0, j}];
where, B[k]
is defined by:
B[k_] := If[ IntegerQ[k/2], β τ + 1, (j + k - 2 μ - 2 ν) φ];
However, if I try and evaluate the following expression:
gp[j_, k_] := ρ g[ j, k];
gp[1,1]
I get a j
which clearly should have been set to 1
I've tried various combinations of Evaluate[]
and :=
assignments but none seem to be working. I can get temporary correct behaviour by doing B[j_, k_] := Evaluate[...]
and calling B[j,k]
from g[j_, k_]
but this then reverts to a failed state when I save it and call as a packaged function
Expected Output
The expected output is:
(ρ φ)/((1 + β τ)^2 + 4 φ^2)
Instead I get:
ρ (-(((-3 + j) φ)/(4 ((1 + β τ)^2 + 4 φ^2))) + ((1 + j) φ)/(4 ((1 + β τ)^2 + 4 φ^2)))
j
inB
to be resolved? Also, avoid using uppercase initials (e.g.B
) for your symbols... $\endgroup$j=1
for allj
inB
. I expect that beforeg[j=1,k=1]
is evaluated thatB[k=1]
will be evaluated. Then thatg
will assign values ofj=k=1
to allj,k
and then will evaluate theSum
andBinomial
- does that make sense? $\endgroup$