Home

A package to calculate CG-coefficient, Racha coefficient, and Wigner 3j, 6j, 9j symbols. We offer two versions of API for all these coefficients.

  1. The exact functions return SqrtRational, which are designed for demonstration. They use BigInt in the internal calculation, and do not cache the binomial table, so they are not efficient.
  2. The floating-point functions return Float64, which are designed for numeric calculation. They use Int, Float64 in the internal calculation, and you should pre-call wigner_init_float to calculate and cache the binomial table for later calculation. They may give inaccurate result for vary large angular momentum, due to floating-point arithmetic. You can find the max error at here: wigner-benchmark.

Install

Just install with Julia REPL and enjoy it.

pkg> add CGcoefficient

Usage

using CGcoefficient
sixJ(1,2,3,4,5,6)

\[\frac{1}{3}\sqrt{\frac{2}{715}}\]

In a markdown enviroment, such as jupyter notebook, it will give you a latex output. You can also do some arithmetics with the result, thus do arithmetics using the SqrtRational type.

x = sixJ(1,2,3,4,5,6) * exact_sqrt(1//7) * exact_sqrt(1//13) * iphase(2+3+5+6)

\[\frac{1}{3}\sqrt{\frac{2}{65065}}\]

The result is not simplified by default, you can use simplify function to simplify it.

simplify(x)

\[\frac{1}{39}\sqrt{\frac{2}{385}}\]

In a console enviroment it will give out a text output.

julia> nineJ(1,2,3,5,4,3,6,6,0)1//39√(2//385)

You can convert a SqrtRational in to BigFloat,

t = sixJ(17/2,9,19/2,15/2,10,15/2)
float(t)
0.006625060239168051702701949513657948806045797449799216745233646948167908577160755

Calling wigner_init_float first to pre-calculate and cache binomial table.

wigner_init_float(10, "Jmax", 6)

Then call a float version function

f6j(17,18,19,15,20,15)
0.006625060239168052

About

This package is inspired by Ref [1]. See CENS-MBPT for details.

The idea is to simplify 3nj Symbols to sum combinations of binomial coefficients. We can calculate binomial coefficients by Pascal's Triangle, and store them first. Then we calculate 3nj Symbols using the stored binomial coefficients.

In this package, we just use the builtin binomial function for exact calculation. Only the float version uses stored binomials.