I was going through the python-flint docs and while looking into the representation of sparse multivariate polynomials, naturally came across fmpz_mpoly and fmpq_mpoly. However, it kind of confuses me that the docs for both are almost identical.
What confuses me the most is that the docstrings for both the classes say that both the respective types represent sparse multivariate polynomials over the integers. What I expected to see in the case of fmpq_mpoly was that it would represent sparse multivariate polynomials over the rationals.
Moreover it's actually naturally possible to construct fmpq_mpoly over the rationals I guess:
In [1]: from flint import *
In [2]: ctx = fmpq_mpoly_ctx.get(('x', 2), 'lex')
In [3]: p = ctx.from_dict({(0, 1): fmpq(1, 2), (1, 1): fmpq(1, 3)})
In [4]: p.coeffs()
Out[4]: [1/3, 1/2]
Makes sense because coeffs() in this case returns a list of fmpq but isn't this what building p over the rationals exactly is ? And doing something similar with fmpz_mpoly will obviously fail since coeffs() in that case will return a list of fmpz and the coercion of 1/2 and 1/3 will henceforth fail.
So why do the docs not say for fmpq_mpoly type that it "represents sparse multivariate polynomials over the rationals. "?
I'm sorry if my question here seems foolish, I'm still trying to get my head around things. Would appreciate any insights!
I was going through the python-flint docs and while looking into the representation of sparse multivariate polynomials, naturally came across
fmpz_mpolyandfmpq_mpoly. However, it kind of confuses me that the docs for both are almost identical.What confuses me the most is that the docstrings for both the classes say that both the respective types represent sparse multivariate polynomials over the integers. What I expected to see in the case of
fmpq_mpolywas that it would represent sparse multivariate polynomials over the rationals.Moreover it's actually naturally possible to construct
fmpq_mpolyover the rationals I guess:Makes sense because
coeffs()in this case returns a list offmpqbut isn't this what buildingpover the rationals exactly is ? And doing something similar with fmpz_mpoly will obviously fail sincecoeffs()in that case will return a list offmpzand the coercion of1/2and1/3will henceforth fail.So why do the docs not say for
fmpq_mpolytype that it "represents sparse multivariate polynomials over the rationals. "?I'm sorry if my question here seems foolish, I'm still trying to get my head around things. Would appreciate any insights!