Skip to content

Explain rational multivariate polynomial inputs - #451

Merged
oscarbenjamin merged 3 commits into
flintlib:mainfrom
Parsnip37:docs/rational-polynomial-example
Nov 23, 2026
Merged

oscarbenjamin merged 3 commits into
flintlib:mainfrom
Parsnip37:docs/rational-polynomial-example

Conversation

@Parsnip37

@Parsnip37 Parsnip37 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Introduce a worked rational-coefficient example before the fmpq_mpoly API listings. Construct p = xy/3 + x/2 + 3y/4 from ctx.gens() and display the polynomial in a doctest transcript. Then give the equivalent coefficient dictionary and explain its exponent tuples, exact rational coefficients, nonnegative exponents and nonzero denominators.

Related to #268 and the maintainer's suggestion to use non-integer rational examples. The coefficient-domain wording was already corrected in #320.

Validation: fresh full baseline and revised Sphinx HTML renders both generated HTML and exited 1 with the same existing definition-list warning in flint.types._gr.gr_ctx.factor. Both used -b html -W --keep-going -E -a with the repository configuration. This is not a clean strict build. The generated text and mathematical markup were inspected from disk. Autodoc imported the published python-flint 0.9.0 binary; the native checkout was not rebuilt. The displayed transcript was derived from source inspection and was not executed locally. No local software test suites, doctests or example programs were run.

Comment thread doc/source/fmpq_mpoly.rst Outdated
Comment on lines +19 to +26
from flint import fmpq, fmpq_mpoly_ctx

ctx = fmpq_mpoly_ctx.get(("x", "y"), "lex")
p = ctx.from_dict({
(1, 1): fmpq(1, 3),
(1, 0): fmpq(1, 2),
(0, 1): fmpq(3, 4),
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better to say

x, y = ctx.gens()
p = x*y/3 + x/2 + 3*y/4

and to display the polynomial in a doctest.

Comment thread doc/source/fmpq_mpoly.rst
Comment on lines +27 to +31
>>> p = ctx.from_dict({
... (1, 1): fmpq(1, 3),
... (1, 0): fmpq(1, 2),
... (0, 1): fmpq(3, 4),
... })

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should print out what p is so that someone reading the docs can interpret the dict format.

@oscarbenjamin

Copy link
Copy Markdown
Collaborator

Okay looks good.

@oscarbenjamin
oscarbenjamin merged commit ad6f9c5 into flintlib:main Nov 23, 2026
95 checks passed
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