# Substituting values in 3j symbols

Bug introduced in 8.0 or earlier and fixed in 10.2.0

I believe these three expressions should give the same answer of -1/Sqrt, but the first gives +1/Sqrt whereas the second and third give the correct value, using Mathematica 8. What am I doing wrong?

ThreeJSymbol[{a, 0}, {b, 0}, {c, 0}] /. {a -> 1, b -> 1, c -> 0}
ThreeJSymbol[{a, 0} /. a -> 1, {b, 0} /. b -> 1, {c, 0} /. c -> 0]
ThreeJSymbol[{1, 0}, {1, 0}, {0, 0}]

• The same incorrect result also happens when I replace ThreeJSymbol with ClebschGordan in the first line. – Jens Aug 2 '14 at 18:58
• Same problem in Mathematica 10 – rhermans Aug 4 '14 at 10:15
• This bug was reported to and acknowledged by Wolfram Technical Support (CASE:1381596). I suggest editing the question to add the tags: "bugs" and "physics" for future reference. Probably the answer by @Jens should be accepted. – rhermans Aug 5 '14 at 16:37
• The problem is still present in Mathematica 10.1.0 – rhermans May 14 '15 at 13:10
• The problem seems to be fixed in version 10.2 Windows 7 64, anybody can confirm in other platforms? – rhermans Jul 17 '15 at 16:44

## 3 Answers

Just to expand on what @eldo has written.

I found that this odd behavior happens for all odd $n$ values where $n$ is the argument of this function:-

f[n_] := Module[{r1, r2, r3},
r1 = ThreeJSymbol[{a, 0}, {b, 0}, {c, 0}] /. {a -> n, b -> n,
c -> 0};
r2 = ThreeJSymbol[{a, 0} /. a -> n, {b, 0} /. b -> n, {c, 0} /.
c -> 0];
r3 = ThreeJSymbol[{n, 0}, {n, 0}, {0, 0}];
{r1, r2, r3}]

f
(*{1/Sqrt, -(1/Sqrt), -(1/Sqrt)}*)


But when $n$ is even all the answers agree.

f
(*{1/Sqrt, 1/Sqrt, 1/Sqrt}*)


So there seems to be an extra minus sign coming from the $(m_1,m_2,m_3)$ part before evaluating these three at (0,0,0).

We can see that here in $f_1(a)$ where we keep $(m_1,m_2,m_3)$ as it is and check for different $a$ values

f1[a_] := ThreeJSymbol[{a, m1}, {a, m2}, {0, m3}]


If you run this you will see that for all odd values of $a$ there is an overall minus sign which then creeps into the final answer because of the reason @eldo mentioned.

The same problem also appears in the related function ClebschGordan. This is indeed a bug which appears when Mathematica is given symbolic parameters instead of specific integers or half-integers. We can check that the first result in the question is incorrect by using the explicit sum definition of ThreeJSymbol given in the documentation under Properties:

Clear[threeJSymbol];
threeJSymbol[{j1_, m1_}, {j2_, m2_}, {j3_,
m3_}] := (1/Sqrt[(1 + j1 + j2 + j3)!])*(-1)^(-j1 + j2 + m3)*
Sqrt[(j1 + j2 - j3)!]*Sqrt[(j1 - j2 + j3)!]*Sqrt[(-j1 + j2 + j3)!]*
Sqrt[(j1 - m1)!]*Sqrt[(j1 + m1)!]*Sqrt[(j2 - m2)!]*Sqrt[(j2 + m2)!]*
Sqrt[(j3 - m3)!]*Sqrt[(j3 + m3)!]*KroneckerDelta[m1 + m2, -m3]*
Sum[(-1)^k/((j1 + j2 - j3 - k)!*
k!*(j1 - k - m1)!*(-j2 + j3 + k + m1)!*(-j1 + j3 + k -
m2)!*(j2 - k + m2)!), {k, Max[0, j2 - j3 - m1, j1 - j3 + m2],
Min[j1 - m1, j2 + m2]}]


With this, all three results agree:

threeJSymbol[{a, 0}, {b, 0}, {c, 0}] /. {a -> 1, b -> 1,
c -> 0}
threeJSymbol[{a, 0} /. a -> 1, {b, 0} /. b -> 1, {c, 0} /. c -> 0]
threeJSymbol[{1, 0}, {1, 0}, {0, 0}]

(* ==> -(1/Sqrt) *)

(* ==> -(1/Sqrt) *)

(* ==> -(1/Sqrt) *)


Instead of using this slower definition, we can still make replacements in ThreeJSymbol by wrapping it in Unevaluated:

Unevaluated[ThreeJSymbol[{a, 0}, {b, 0}, {c, 0}]] /. {a -> 1,
b -> 1, c -> 0}

(* ==> -(1/Sqrt) *)


Line1: ThreeJSymbol is evaluated before replacement. Line2: ThreeJSymbol is evaluated after replacement. To give another example:

D[x^2, x] /. x -> 2


4

D[x^2 /. x -> 2, x]


0

• Although this is true, I don't think that it explains the incorrect behavior. – Jens Aug 2 '14 at 18:59