WignerD.doit doesn't work for half integer spin

37 views
Skip to first unread message

Che Liu

unread,
Aug 26, 2020, 1:47:26 PM8/26/20
to sympy
Hi, 

Seems like WignerD.doit would error for half integer spin.
If you run
Capture.PNG
with j = 1/2,
then an exception is raised in the doit() function:
Capture.PNG
The problem rests in the m_values function. For your reference:Capture.PNG
Line 56 gives 2.0 for j==1/2, and its is_Integer attribute is false.

The same problem occurs for 
Capture.PNG
but not for
Capture.PNG
Any ways to get around it?
My sympy version is 1.6.2, and I run these on a Windows system.

Thanks

Naman Nimmo

unread,
Aug 26, 2020, 2:02:24 PM8/26/20
to sy...@googlegroups.com
Hi!

You can pass in a `Rational`.

```
>>> a = WignerD(Rational(1, 2), Rational(1, 2), Rational(1, 2), pi, pi/2, 0)
>>> a.doit()
-sqrt(2)*I/2


```

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/c3aa6eac-fc9c-4b2e-bd8c-e539bcb3dfa4n%40googlegroups.com.

Che Liu

unread,
Aug 26, 2020, 2:14:58 PM8/26/20
to sympy
Thank you for the help!

Aaron Meurer

unread,
Aug 26, 2020, 3:25:29 PM8/26/20
to sympy
It should probably be made to work with floating point half integers. Half integers are exactly representable as floats, so it isn't an issue.

Aaron Meurer

Reply all
Reply to author
Forward
0 new messages