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

Support for multivariate power series #131

Closed
Dioprz opened this issue Apr 8, 2024 · 5 comments
Closed

Support for multivariate power series #131

Dioprz opened this issue Apr 8, 2024 · 5 comments

Comments

@Dioprz
Copy link

Dioprz commented Apr 8, 2024

Hello,

I'm currently working on the cryptography library CryptographicEstimators originally built as a Sage module, but which we are now looking to make independent of Sage to reduce its size.

Python-flint currently provides everything we were using in Sage except for one thing, the handling of multivariate power series (bivariate, in particular). Because of this I would like to ask you:

  1. Is it in the near roadmap to expose a way to create and manipulate multivariate series, as it is for univariate series?

  2. What would it require someone to work on exposing these features from C flint, to add it to python-flint? Is there any guidance/documentation, or for now is there just the code already implemented for reference?

Finally, thank you very much for all the work done so far with this project. It will allow us to provide more accessibility to the use and community development of our library, so we really appreciate it.

@oscarbenjamin
Copy link
Collaborator

Hello,

A first step in python-flint's roadmap would be multivariate polynomials (gh-59) which would presumably be the representation for multivariate series. Adding multivariate polynomials is my top priority in terms of features.

The series types in python-flint operate with Flint's univariate polynomial types and call the related e.g. fmpq_poly_*_series functions:
https://flintlib.org/doc/fmpq_poly.html#transcendental-functions

I don't see analogues of these series functions for multivariate polynomials in Flint itself e.g. there is no fmpq_mpoly_exp_series etc:
https://flintlib.org/doc/index_rationals.html

Which flint functions are you using from Sage?

Maybe the multivariate series are actually implemented in Sage rather than Flint...

2. Is there any guidance/documentation, or for now is there just the code already implemented for reference?

Pretty much the code is a reference. It can certainly be tidied up in places though. There are a few open issues where some broader reorganisations are discussed but for now new features are just new types like the existing ones. These PRs are the most recent feature additions for reference: #87 #106.

Feel free to ask here on GitHub for specific help on how to do anything.

@fredrik-johansson
Copy link
Collaborator

There are generic power series in Flint, which can be nested to emulate multivariates:

>>> from flint_ctypes import *
>>> R = PowerSeriesRing(PowerSeriesRing(QQ, prec=10, var="x"), prec=8, var="y")
>>> x, y = R.gens(recursive=True)
>>> (x+y).exp().log()
(x + O(x^10)) + (1 + O(x^10))*y + (0 + O(x^10))*y^2 + (0 + O(x^10))*y^3 + (0 + O(x^10))*y^4 + (0 + O(x^10))*y^5 + (0 + O(x^10))*y^6 + (0 + O(x^10))*y^7 + O(y^8)

>>> R = PowerSeriesModRing(PowerSeriesModRing(QQ, 10, var="x"), 8, var="y")
>>> x, y = R.gens(recursive=True)
>>> (x+y).exp().log()
(x (mod x^10)) + (1 (mod x^10))*y (mod y^8)

@Dioprz
Copy link
Author

Dioprz commented May 7, 2024

Hi again,

I apologize for the delay in my response. We've been focusing on removing other Sage-dependent sections, but I'm finally able to address this issue.

Thank you both for your helpful responses! They've given me a much clearer picture of the library context.

We've determined that our unique bivariate series can be rephrased as operations over two univariate power series. This approach will allow us to work more efficiently using the existing features of python-flint.

Now, the nested approach you mentioned seems very interesting and powerful. Do you think that example could be included in the documentation? I could even send the PR myself, and if I discover any additional information during the refactoring process, I'll be happy to add that as well.

Please let me know your thoughts, and consider this issue resolved.

@oscarbenjamin
Copy link
Collaborator

What Fredrik is referring to is something that is not actually implemented in python-flint but rather that can be done if you build Flint directly yourself.

Currently python-flint does not expose Flint's generic ring (gr_*) types. We definitely want to add those to python-flint but can't give an ETA for those right now.

What I can say is that the next release of python-flint will have multivariate polynomials (gh-132). You could implement bivariate series with those but would need to write various parts yourself so how easy that is depends on what exact features you need.

@Dioprz
Copy link
Author

Dioprz commented May 8, 2024

Huh, yes, I misunderstood his answer.

Well, in that case, no problem! As said, current features of python-flint should give us everything we need for now, so I think we will be fine.

Thanks again, and I'll let you know how it all works out once we've finished the implementations.

@Dioprz Dioprz closed this as completed May 8, 2024
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

3 participants