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

Proposal: Use real Clausen functions instead of complex Polylogarithms #27

Closed
Expander opened this issue Jun 2, 2023 · 3 comments
Closed

Comments

@Expander
Copy link

Expander commented Jun 2, 2023

Dear CollectiveSpins developers,

I've noticed that in the function Omega_k_chain the following expression is calculated:
$$\Re(\text{Li}_3(e^{i(k_0+k)a}) + \text{Li}_3(e^{i(k_0-k)a}) - ik_0a[\text{Li}_2(e^{i(k_0+k)a}) + \text{Li}_2(e^{i(k_0-k)a})])$$
This expression uses (time-costly) complex polylogarithms. However, the result is purely real. I believe this expression can be expressed in terms of simpler real Clausen functions, due to the following relations:
$$\Re[\text{Li}_3(e^{i\theta})] = \text{Cl}_3(\theta),\qquad\Im[\text{Li}_2(e^{i\theta})] = \text{Cl}_2(\theta)$$
Using these relations I believe the first expression can be written as:
$$\text{Cl}_3[(k_0+k)a] + \text{Cl}_3[(k_0-k)a] + k_0a(\text{Cl}_2[(k_0+k)a] + \text{Cl}_2[(k_0-k)a])$$
which can be significantly faster when a fast implementation of the Clausen functions is used.

In Julia one could use the package ClausenFunctions.jl which provide very fast implementations of $\text{Cl}_2$ and $\text{Cl}_3$:

using ClausenFunctions
cl2(1.0)
cl3(1.0)

Best regards
Alexander Voigt

@david-pl
Copy link
Member

Hi Alexander,

thanks for pointing that out! I think you're right, at least tests pass locally if I switch things the way you suggested. Now I'm just waiting for CI to pass in #28. The next version of CollectiveSpins should include this then.

Cheers,
David

@Expander
Copy link
Author

Hi David,

great! Thanks for considering this change!

Best regards
Alexander

(I think we can close this issue now.)

@david-pl
Copy link
Member

It's now available with the new version of CollectiveSpins. FYI, also @taylorpatti

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