Ask Your Question
2

Defining 4jm Wigner symbols

asked 2020-09-30 22:15:10 +0100

pmd gravatar image

Hi everyone,

I am a neophyte and I can't understand my error in spite of the many tutorials I have watched. I want to define the 4jm Wigner symbols, which should basically be defined as:

var('m') 
wigner_4j(j1,j2,j3,j4,j,m1,m2,m3,m4) = sum(wigner_3j(j1,j2,j,m1,m2,m)*wigner_3j(j,j3,j4,-m,m3,m4),m,-j,j)

I get plenty of errors that I can't fix. It is weird to me because the overall logic seemed good, as it works for instance when I define in a similar manner:

var('n')
b(p,q) = sum(binomial(p,n)*binomial(q,n),n,0,min(p,q))

Thanks for your help!

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2020-09-30 23:24:16 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2020-09-30 23:00:54 +0100

rburing gravatar image

With this syntax you are trying to create a callable symbolic expression. It doesn't work because the symbolic sum that you are using requires a symbolic expression (depending on the symbolic summation index m here) as the first argument, and wigner_3j in Sage does not accept symbolic arguments, only numeric arguments (more precisely, only integers or half-integers). This explains the errors. (By contrast, Sage does support symbolic binomial coefficients and sums, and hence callable symbolic expressions involving them.)

In this case you have no need for symbolics at all; you can just define a plain Python function, using the plain (non-symbolic) sum:

wigner_4j = lambda j1,j2,j3,j4,j,m1,m2,m3,m4: sum(wigner_3j(j1,j2,j,m1,m2,m)*wigner_3j(j,j3,j4,-m,m3,m4) for m in range(-j,j+1))

Or, without lambda:

def wigner_4j(j1,j2,j3,j4,j,m1,m2,m3,m4):
    return sum(wigner_3j(j1,j2,j,m1,m2,m)*wigner_3j(j,j3,j4,-m,m3,m4) for m in range(-j,j+1))
edit flag offensive delete link more

Comments

Perfect, thanks for your help!

pmd gravatar imagepmd ( 2020-10-01 13:56:23 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-09-30 22:04:35 +0100

Seen: 625 times

Last updated: Sep 30 '20