-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Documentation: polynomials and division #11425
Conversation
multiplications before additions and subtractions. | ||
The products of generators thus obtained are called | ||
*monomials*. They are usually written in the form | ||
`x_1^{\nu_1}x_2^{\nu_2}\cdots x_n^{\nu_n}` where the exponents `\nu_i` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you need to use :math:
4 +5 `` for this to render?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not seem necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I thought you had to use the math directive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backquotes automatically do inline math. You only need a .. math::
for display math.
This is very nice and helpful! Please run sphinx and see if the math renders properly. |
I have done that. I could put up a html version in Google drive if desired. |
No need. Just wanted to make sure the math renders. This is fine to merge. It's a great improvement. |
doc/src/modules/polys/basics.rst
Outdated
properly as an algebraic number. | ||
|
||
Divisibility | ||
------------ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to see some code examples in the following sections to show the relevancy to what a user would do in SymPy with polynomials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is explained, at least to some extent, in the sequel of the same file basics.rst
. See http://docs.sympy.org/latest/modules/polys/basics.html, Basic functionality .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not expect an example necessarily, since this is a section named "Basic Concepts", otherwise in the same file we do have a section named "Basic functionality" (mostly contains code examples) which does contain examples of divisibility
i.e div
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jksuom I didn't saw your comment (commented there on the outdated version). I can't believe I almost commented the same thing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure that's all fine. I'm just giving you my opinion as a user that doesn't care too much about polynomial theory. The polynomial module's dosctrings and documentation seem to lack a pointed introduction for people that just want to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The polynomial module's dosctrings and documentation seem to lack a pointed introduction for people that just want to use it.
I think so too. This text aims to give background information for the developers, those who would write the docstrings or implement polynomial methods in symengine.
Thanks for the review, @smichr ! |
doc/src/modules/polys/basics.rst
Outdated
Given a family `(x_i)` of symbols, or other suitable objects, | ||
expressions derived from them by repeated addition, subtraction | ||
and multiplication are called *polynomial expressions in the | ||
generators* `x_i`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And some base field or ring of coefficients.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, so they are included in the x_i. In that case, maybe mention "or other suitable objects, including numbers" or something like that. I think I understand what you are defining here, but it's easy to confuse this with what people usually think of as a "polynomial".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to make a distinction between 'polynomial expressions' and 'polynomials'. The belong to different classes in SymPy. Adding 'including numbers' here seems a good idea. But I did not want to introduce base rings at this point.
(Writing expository texts is always balancing between brevity and completeness.)
The definition in the beginning seems a bit confusing, especially since you jump directly to SymPy expressions, but the definition doesn't exactly match how expressions work in SymPy. I read through the rest of the document and it looks fine, excepting my comments. |
Maybe the division and gcd examples below this could be incorporated into the text. |
Can you elaborate on this? |
Do you mean that the examples in the next section on 'Basic Functionality' should be moved here? |
Yes |
What should be done with the rest of 'Basic Functionality'? In particular the subsections on Division and GCD. |
I guess just leave it there at the end. There is no in-depth discussion of factoring and groebner bases (although there could be). |
An alternative might be to split out the theory discussion and the examples into separate documents. |
Advantages of splitting theory and examples/usage:
Disadvantages:
What do you think? I think it would be great to have more theoretical discussions like this in the SymPy docs (contingent on people writing it, of course). |
I think that examples are well suited for this type of introductory texts. Although there are 'theoretical discussions' I have tried to make them readable for everybody explaining only such concepts that seem essential for an understanding of the subject and its implementation. I have expanded the polynomial part of the text and added examples to the divisibility section. |
Do you intend to add more here? There are still a couple of minor typo comments to address, but otherwise I am +1 to merge if you are done. |
This is as far as I had intended to go. I only wanted to clarify some concepts to help those who want to write docstrings or implement polys methods in symengine. |
doc/src/modules/polys/basics.rst
Outdated
|
||
`a = qb + r` | ||
|
||
and such that either `r = 0` or `w(r) < w(b)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strike 'and' here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right. In a mathematical text these conditions are typically added on the same line after the equation with a quad or two to separate them. Here, I felt that some words were needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could add 'are' after 'and' if you want to keep the 'and', but I don't see a problem with just writing
"such that either r = 0
or w(r) < w(b)
. "
But since you don't refer to 'q' you might just say
"where either r = 0
or w(r) < w(b)
. "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel quite comfortable with your first suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been waiting for #11558 to be finished. Then some examples have to be modified. I was planning to fix the minor flaws in the same commit. |
Yes, I'll try to find some time for this. |
The typos should also be fixed. Can you point out those that I didn't find? |
I didn't re-read everything but looked at where comments had been made to see if anything still needed to be done and made comments as necessary. |
Symbolic numbers will no more lead to the EX domain after sympy#11558.
The comments that I added aren't showing up here. See the commit tab and search for today's date to see the comments I left. |
Thanks! This can now go in the next release. |
Documentation for some basic concepts in
polys
.