#include "TROOT.h" #include "Math/SpecFunc.h" double ClebschGordan(float j1,float m1,float j2,float m2,float j3,float m3){ int two_ja=round(2*j1); int two_jb=round(2*j2); int two_jc=round(2*j3); int two_ma=round(2*m1); int two_mb=round(2*m2); int two_mc=round(2*m3); return pow(-1,(two_ja-two_jb+two_mc)/2)*sqrt(two_jc+1) *ROOT::Math::wigner_3j(two_ja,two_jb,two_jc,two_ma,two_mb,-two_mc); }
#include <stdio.h> #include "ClebschGordan.h" int main(){ printf("%f\n",ClebschGordan(2,2,2,-2,1,0)); return 0; }
g++ calc.cxx -o calc `root-config --cflags --libs` -lMathMore
$ ./calc 0.632456