Author 
Comment/Response 
Rasto

10/31/11 10:15am
Hello,
I found this forum searching for some mathematica support fora, I hope it's the correct one for my question. I have to confess to not having throughly read Mathematica's manual, so my understanding of how functions work might be a problem here. This is what I'm trying to do:
Define a simple recursive function:
f[0, n_] := 1
f[1, n_] := 1/2
f[m_, n_] := (1/m) Coefficient[Sum[Sum[Sum[
1/((2*k)!)*i^(2 k)*1/(2 m  2 k  2)!*(n  j)^(2*m  2*k  2), {k, 0, m  1}], {j, i + 1, n}], {i, 0, n}], n, 2*m]
The function should evaluate to 1/(2*m)!, it computes leading term of a recursively defined polynomial which is at this point irrelevant.
Indeed, Mathematica evaluates it as it should:
f[2,n]
1/24
f[3, n]
1/720
Now I make two functions that use this one, in the first one I use f[m,n] explicitly and in the second one I substitute it with 1/(2*m)!
g[m_, n_] :=
Coefficient[Sum[Sum[Sum[(1/(2*k)!)*
i^(2 k)*(1/(2 m  2 k  2)!)*(n  j)^(2*m  2*k  2), {k, 0, m  1}]^2, {j, i + 1, n}], {i, 0, n}], n, 4*m  2]
h[m_, n_] :=
Coefficient[Sum[Sum[Sum[f[k, n]*i^(2 k)*f[2 m  2 k  2, n]*(n  j)^(2 m  2 k  2), {k, 0, m  1}]^2, {j, i + 1, n}], {i, 0, n}], n, 4*m  2]
The functions g and h are identical, only in one I write (1/(2*k)!) and in the other f[k,n]. One would expect the same result, but no:
g[2, n]
7/360
h[2,n]
149/17280
I suspect I am missing something about manipulating with variables and functions, but reading the help didn't help me so I'm asking here. Thanks!
URL: , 
