rokzitko / nrgljubljana

NRG Ljubljana is a numerical renormalization group implementation for solving quantum impurity problems in theoretical physics
GNU General Public License v3.0
31 stars 8 forks source link

Conjugation of powers of subscripted constants in mathematica #14

Open joshkamm opened 2 years ago

joshkamm commented 2 years ago

Description

Not sure if this is the right place to post about the SNEG library underlying this library but I didn't see a specific repository for it.

There seems to be a quirk in the low level manipulation of Dirac notation.

Here is a minimal reproducing code example which is a simpler version of the more complicated manipulation I was originally performing which got stuck simplifying.

Code example

<< "sneg-1.250/sneg.m"
snegrealconstants[c, Subscript[c, 1]]
conj[c*VACUUM]
conj[c*c*VACUUM]
conj[Subscript[c, 1]*VACUUM]
conj[Subscript[c, 1]*Subscript[c, 1]*VACUUM]

Output: image

Expected behavior: SNEG recognizes a power of a subscripted constant like the other constant above

Actual behavior: SNEG appears to not recognize the power of a real constant containing a subscript.

Versions

Mathematica 13.0 SNEG 1.250

rokzitko commented 2 years ago

I'll reply here, since there is indeed no separate repository for SNEG. The best solution is to simply define the required properties:

snegnonopQ[Subscript[c, ___]] := True;
Conjugate[x : Subscript[c, ___]] ^= x;

The first line specifies that c with a subscript is not an operator, and the second one declares it to be a real quantity.

rokzitko commented 2 years ago

Just for the record, there is now a github repo for sneg: https://github.com/rokzitko/sneg