I have been exploring the SNEG library. Suppose that after a series of computations I obtain the output:

$$ c_{i,j}^\dagger c_{x,y}^\dagger. $$

How can the quantum numbers $\{i,j\}$ and $\{x,y\}$ be extracted (computationally) from this expression? For example, if the quantum numbers correspond to angular momentum, I would like to write an automated procedure to compute Clebsh-Gordan coefficients.

The simplest code to generate such an output is as follows.

nc[c[CR, i, j], c[CR, x, y]]
  • 2
    $\begingroup$ What would the actual output be? You show the tex formatted expression, but no actual code output. Please give an example of the sort of output you will be working with, in a code block that can be copy and pasted. Thanks! $\endgroup$ Jan 8, 2022 at 3:16
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Jan 8, 2022 at 4:53
  • 1
    $\begingroup$ Replace[Extract[YourExpression, {{1, 2}, {2, 2}}], head_[arg__] :> List[arg], {0, Infinity}] works for the expression you gave, I think. Unless I misunderstood what you are after which may as well be the case since I'm not familiar with any of the maths that you are talking about :) $\endgroup$
    – amator2357
    Jan 9, 2022 at 23:58
  • $\begingroup$ The comment provided by @amator2357 solves the problem. Thanks! $\endgroup$
    – aRockStr
    Jan 11, 2022 at 15:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.