Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could the index of operator be more flexible? #25

Open
Hongy973 opened this issue Nov 18, 2024 · 3 comments
Open

Could the index of operator be more flexible? #25

Hongy973 opened this issue Nov 18, 2024 · 3 comments

Comments

@Hongy973
Copy link

Hi there,

Sorry to bother you. I'm encountering an issue while using QuantumAlgebra to calculate commutators in tight-binding models. Specifically, I need to define a summation like $\sum_{i} f^{\dagger}_{i+1}f_i$, which represents hopping between sites.

However, it seems that the index of the summed operator can only be assigned a single symbol, which makes it challenging to express terms with shifted indices. Would it be possible to make the operator indices more flexible?

Thank you for your help and for developing such a useful tool!

Best regards,
Yuan Hong

@jfeist
Copy link
Owner

jfeist commented Nov 20, 2024

Hi,
Unfortunately, this is not really possible right now. In order for expressions like this to be interpreted correctly, QuantumAlgebra would need to be able to do some kind of symbolic algebra with the indices to know that "i+1" contains the summed index, i.e., it would need to be able to recognize that "i+1" contains the index "i". E.g., for $[f_3, \sum_i f_{i+1}^\dagger f_i] = f_2$, it would need to be able to obtain $\delta_{i+1,3}$ and simplify that to $\delta_{i,2}$, or for $[f_j, \sum_i f_{i+1}^\dagger f_i] = f_{j-1}$, it would need to do so for symbolic arguments. As long as only given integer shifts are required (i.e., $i+1$, $i+2$, etc.), implementing support would probably not be an insurmountable task, but it would require a signficant rewrite of index handling. I will keep it in mind, but cannot promise that I will do it soon (or ever...).

BTW, a possible workaround depending on your use case may be to write $\sum_{i,j} t_{i,j} f_j^\dagger f_i$ (enter as ∑((:i,:j),Pr"t_i,j"*f'(:j)f(:i))), and then in the final result (manually or programatically) replace $t_{i,j}$ by $\delta_{j,i+1}$.

@Hongy973
Copy link
Author

Hi,
Thank you so much for your detailed and thoughtful response! I truly appreciate the time you took to explain the challenges involved and to suggest a potential workaround.

@jfeist jfeist reopened this Nov 21, 2024
@jfeist
Copy link
Owner

jfeist commented Nov 21, 2024

Thanks! I've reopened the issue to make sure I don't forget about it in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants