Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I believe these three expressions should give the same answer of -1/Sqrt[3], but the first gives +1/Sqrt[3] 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}]  
share|improve this question
1  
The same incorrect result also happens when I replace ThreeJSymbol with ClebschGoradan in the first line. –  Jens Aug 2 at 18:58
    
Same problem in Mathematica 10 –  rhermans Aug 4 at 10:15
1  
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 at 16:37

3 Answers 3

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[3]
(*{1/Sqrt[7], -(1/Sqrt[7]), -(1/Sqrt[7])}*)

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

f[2]
(*{1/Sqrt[5], 1/Sqrt[5], 1/Sqrt[5]}*)

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.

share|improve this answer

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[3]) *)

(* ==> -(1/Sqrt[3]) *)

(* ==> -(1/Sqrt[3]) *)

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[3]) *)
share|improve this answer

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.