code: def test_couple_4_states():
      # Default coupling
      # j1=1/2, j2=1/2, j3=1/2, j4=1/2
      assert JzKetCoupled(
          1, 1, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(1, 1, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          1, 0, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(1, 0, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          1, -1, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(1, -1, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          2, 2, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(2, 2, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          2, 1, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(2, 1, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          2, 0, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(2, 0, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          2, -1, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(2, -1, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      assert JzKetCoupled(
          2, -2, (S.Half, S.Half, S.Half, S.Half)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(2, -2, (S.Half, S.Half, S.Half, S.Half))
              )
          )
      )
      # j1=1/2, j2=1/2, j3=1/2, j4=1
      assert JzKetCoupled(
          S.Half, S.Half, (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      S.Half, S.Half, (S.Half, S.Half, S.Half, 1)
                  )
              )
          )
      )
      assert JzKetCoupled(
          S.Half, Rational(-1, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      S.Half,
                      Rational(-1, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(3, 2), Rational(3, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      Rational(3, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(3, 2), S.Half, (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      S.Half,
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(3, 2), Rational(-1, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      Rational(-1, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(3, 2), Rational(-3, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      Rational(-3, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(5, 2), Rational(5, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(5, 2),
                      Rational(5, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(5, 2), Rational(3, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(5, 2),
                      Rational(3, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(5, 2), S.Half, (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(5, 2),
                      S.Half,
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(5, 2), Rational(-1, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(5, 2),
                      Rational(-1, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(5, 2), Rational(-3, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(5, 2),
                      Rational(-3, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      assert JzKetCoupled(
          Rational(5, 2), Rational(-5, 2), (S.Half, S.Half, S.Half, 1)
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(5, 2),
                      Rational(-5, 2),
                      (S.Half, S.Half, S.Half, 1),
                  )
              )
          )
      )
      # Coupling j1+j3=j13, j2+j4=j24, j13+j24=j
      # j1=1/2, j2=1/2, j3=1/2, j4=1/2, j13=1, j24=0
      assert JzKetCoupled(
          1,
          1,
          (S.Half, S.Half, S.Half, S.Half),
          ((1, 3, 1), (2, 4, 0), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      1,
                      (S.Half, S.Half, S.Half, S.Half),
                      ((1, 3, 1), (2, 4, 0), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          0,
          (S.Half, S.Half, S.Half, S.Half),
          ((1, 3, 1), (2, 4, 0), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      0,
                      (S.Half, S.Half, S.Half, S.Half),
                      ((1, 3, 1), (2, 4, 0), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          -1,
          (S.Half, S.Half, S.Half, S.Half),
          ((1, 3, 1), (2, 4, 0), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      -1,
                      (S.Half, S.Half, S.Half, S.Half),
                      ((1, 3, 1), (2, 4, 0), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      # j1=1/2, j2=1/2, j3=1/2, j4=1, j13=1, j24=1/2
      assert JzKetCoupled(
          S.Half,
          S.Half,
          (S.Half, S.Half, S.Half, 1),
          ((1, 3, 1), (2, 4, S.Half), (1, 2, S.Half)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      S.Half,
                      S.Half,
                      (S.Half, S.Half, S.Half, 1),
                      ((1, 3, 1), (2, 4, S.Half), (1, 2, S.Half)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          S.Half,
          Rational(-1, 2),
          (S.Half, S.Half, S.Half, 1),
          ((1, 3, 1), (2, 4, S.Half), (1, 2, S.Half)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      S.Half,
                      Rational(-1, 2),
                      (S.Half, S.Half, S.Half, 1),
                      ((1, 3, 1), (2, 4, S.Half), (1, 2, S.Half)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          Rational(3, 2),
          Rational(3, 2),
          (S.Half, S.Half, S.Half, 1),
          ((1, 3, 1), (2, 4, S.Half), (1, 2, Rational(3, 2))),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      Rational(3, 2),
                      (S.Half, S.Half, S.Half, 1),
                      (
                          (1, 3, 1),
                          (2, 4, S.Half),
                          (1, 2, Rational(3, 2)),
                      ),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          Rational(3, 2),
          S.Half,
          (S.Half, S.Half, S.Half, 1),
          ((1, 3, 1), (2, 4, S.Half), (1, 2, Rational(3, 2))),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      S.Half,
                      (S.Half, S.Half, S.Half, 1),
                      (
                          (1, 3, 1),
                          (2, 4, S.Half),
                          (1, 2, Rational(3, 2)),
                      ),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          Rational(3, 2),
          Rational(-1, 2),
          (S.Half, S.Half, S.Half, 1),
          ((1, 3, 1), (2, 4, S.Half), (1, 2, Rational(3, 2))),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      Rational(-1, 2),
                      (S.Half, S.Half, S.Half, 1),
                      (
                          (1, 3, 1),
                          (2, 4, S.Half),
                          (1, 2, Rational(3, 2)),
                      ),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          Rational(3, 2),
          Rational(-3, 2),
          (S.Half, S.Half, S.Half, 1),
          ((1, 3, 1), (2, 4, S.Half), (1, 2, Rational(3, 2))),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      Rational(3, 2),
                      Rational(-3, 2),
                      (S.Half, S.Half, S.Half, 1),
                      (
                          (1, 3, 1),
                          (2, 4, S.Half),
                          (1, 2, Rational(3, 2)),
                      ),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      # j1=1/2, j2=1, j3=1/2, j4=1, j13=0, j24=1
      assert JzKetCoupled(
          1,
          1,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 0), (2, 4, 1), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      1,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 0), (2, 4, 1), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          0,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 0), (2, 4, 1), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      0,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 0), (2, 4, 1), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          -1,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 0), (2, 4, 1), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      -1,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 0), (2, 4, 1), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      # j1=1/2, j2=1, j3=1/2, j4=1, j13=1, j24=1
      assert JzKetCoupled(
          0,
          0,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 0)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      0,
                      0,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 0)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          1,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      1,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          0,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      0,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          1,
          -1,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 1)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      1,
                      -1,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 1)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          2,
          2,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      2,
                      2,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          2,
          1,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      2,
                      1,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          2,
          0,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      2,
                      0,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          2,
          -1,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      2,
                      -1,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
      assert JzKetCoupled(
          2,
          -2,
          (S.Half, 1, S.Half, 1),
          ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
      ) == expand(
          couple(
              uncouple(
                  JzKetCoupled(
                      2,
                      -2,
                      (S.Half, 1, S.Half, 1),
                      ((1, 3, 1), (2, 4, 1), (1, 2, 2)),
                  )
              ),
              ((1, 3), (2, 4), (1, 2)),
          )
      )
  
imports: from sympy.concrete.summations import Sum
  from sympy.core.function import expand
  from sympy.core.numbers import I, Rational, pi
  from sympy.core.singleton import S
  from sympy.core.symbol import symbols
  from sympy.functions.elementary.exponential import exp
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.trigonometric import cos, sin
  from sympy.matrices.dense import Matrix
  from sympy.abc import alpha, beta, gamma, j, m
  from sympy.physics.quantum import hbar, represent, Commutator, InnerProduct
  from sympy.physics.quantum.qapply import qapply
  from sympy.physics.quantum.tensorproduct import TensorProduct
  from sympy.physics.quantum.cg import CG
  from sympy.physics.quantum.spin import Jx, Jy, Jz, Jplus, Jminus, J2, JxBra, JyBra, JzBra, JxKet, JyKet, JzKet, JxKetCoupled, JyKetCoupled, JzKetCoupled, couple, uncouple, Rotation, WignerD
  from sympy.testing.pytest import raises, slow
label_desc: Use image node_id 21 for calling a global function with example usage: test_couple_4_states() without return types