| Author |
Comment/Response |
yehuda
|
11/28/12 01:20am
m and n are local variables of Table, so PieceWise has to be defined within Table and not outside of it, as you did. Outside Table there is no meaning to the local variables
So, the order of Piecewise and Table need to be reversed
A=Table[Piecewise[{{0,
EvenQ[n]}, {8/Pi^2*m*(-1)^m/((2*n - 1)*((2*n - 1)^2 + m^2)),
True}}], {n, 1, Nmax}, {m, 1, Mmax}]
A small test
With[{Nmax = 3, Mmax = 4},
Table[Piecewise[{{0,
EvenQ[n]}, {8/Pi^2*m*(-1)^m/((2*n - 1)*((2*n - 1)^2 + m^2)),
True}}], {n, 1, Nmax}, {m, 1, Mmax}]]
returns
{{-(4/\[Pi]^2), 16/(5 \[Pi]^2), -(12/(5 \[Pi]^2)), 32/(
17 \[Pi]^2)}, {0, 0, 0, 0}, {-(4/(65 \[Pi]^2)), 16/(
145 \[Pi]^2), -(12/(85 \[Pi]^2)), 32/(205 \[Pi]^2)}}
as expected
yehuda
URL: , |
|