9
$\begingroup$

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[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}]  
$\endgroup$
5
  • 1
    $\begingroup$ The same incorrect result also happens when I replace ThreeJSymbol with ClebschGordan in the first line. $\endgroup$
    – Jens
    Aug 2, 2014 at 18:58
  • $\begingroup$ Same problem in Mathematica 10 $\endgroup$
    – rhermans
    Aug 4, 2014 at 10:15
  • 1
    $\begingroup$ 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. $\endgroup$
    – rhermans
    Aug 5, 2014 at 16:37
  • $\begingroup$ The problem is still present in Mathematica 10.1.0 $\endgroup$
    – rhermans
    May 14, 2015 at 13:10
  • $\begingroup$ The problem seems to be fixed in version 10.2 Windows 7 64, anybody can confirm in other platforms? $\endgroup$
    – rhermans
    Jul 17, 2015 at 16:44

3 Answers 3

4
$\begingroup$

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.

$\endgroup$
3
$\begingroup$

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]) *)
$\endgroup$
2
$\begingroup$

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

$\endgroup$
1
  • 2
    $\begingroup$ Although this is true, I don't think that it explains the incorrect behavior. $\endgroup$
    – Jens
    Aug 2, 2014 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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