1 | initial version |

With this syntax you are trying to create a callable symbolic expression. It doesn't work because the symbolic `sum`

that you are using requires a symbolic expression (depending on the symbolic summation index `m`

here) as the first argument, and `wigner_3j`

in Sage does not accept symbolic arguments, only numeric arguments (more precisely, only integers or half-integers). This explains the errors. (By contrast, Sage does support symbolic binomial coefficients and sums, and hence callable symbolic expressions involving them.)

In this case you have no need for symbolics at all; you can just define a plain Python function, using the plain (non-symbolic) `sum`

:

```
wigner_4j = lambda j1,j2,j3,j4,j,m1,m2,m3,m4: sum(wigner_3j(j1,j2,j,m1,m2,m)*wigner_3j(j,j3,j4,-m,m3,m4) for m in range(-j,j+1))
```

Or, without `lambda`

:

```
def wigner_4j(j1,j2,j3,j4,j,m1,m2,m3,m4):
return sum(wigner_3j(j1,j2,j,m1,m2,m)*wigner_3j(j,j3,j4,-m,m3,m4) for m in range(-j,j+1))
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.