Skip to content

Add Calcium support for complete elliptic integrals #2302

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lgoetzfried
Copy link

@lgoetzfried lgoetzfried commented Apr 15, 2025

As stated, this PR would like to introduce complete elliptic integrals of the first, second and third kind with exact arguments in the Calcium framework: ca_elliptic_k, ca_elliptic_e and ca_elliptic_pi. In my opinion, support of multiple transcendental functions enhances the functionality and allows for more applications of the FLINT library, in particular since user-defined functions in Calcium are not yet supported.

The implementation is quite basic. I have implemented the Legendre relation of the elliptic integrals to allow for some simplifications, but so far no further functional equations.

(I just encountered myself the situation that I would have liked to work with elliptic integrals, but did not find them implemented. I think that they can also be useful for anyone else, and in particular the implementation was almost cost-free. Thus I thought that maybe such a pull request would be sensible.)

Best regards.

@lgoetzfried lgoetzfried changed the title Added Calcium support for complete elliptic integrals Add Calcium support for complete elliptic integrals Apr 15, 2025
Comment on lines 56 to 57
ulong* exp = (ulong*) flint_malloc(len * sizeof(ulong));
if (exp != NULL){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can always assume that exp != NULL.

ulong exp[len];
for (slong v = 0; v < len; v++){
exp[v] = 0;
ulong* exp = (ulong*) flint_malloc(len * sizeof(ulong));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use (1) alloca or (2) GR_TMP_ALLOC joined with GR_TMP_FREE (see gr.h). No need to use malloc for something small.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now changed it to GR_TMP_ALLOC.

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

Successfully merging this pull request may close these issues.

2 participants