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

clean up the factor() docstring/interface for univariate polynomials #13272

Closed
saraedum opened this issue Jul 19, 2012 · 22 comments
Closed

clean up the factor() docstring/interface for univariate polynomials #13272

saraedum opened this issue Jul 19, 2012 · 22 comments

Comments

@saraedum
Copy link
Member

Working on #11731, I realized that the docstring for factor() could also be cleaned up.

To make reviewing easier, I moved this to a separate ticket.

Component: documentation

Author: Julian Rueth

Branch/Commit: u/pbruin/13272-factor_args_doc @ f63ffd2

Reviewer: Peter Bruin, Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/13272

@saraedum
Copy link
Member Author

remove proof keyword

@saraedum
Copy link
Member Author

comment:1

Attachment: trac_13272_proof.patch.gz

I mostly tried to simplify the wording in some places and unify the way polynomial rings are constructed. I changed the example where _factor_univariate_polynomial() is replaced since adding factorization where none is present seemed more natural to me. I removed the test for Test that this factorization really uses ``nffactor()`` internally since it apparently did not test anything: PARI's debug output is sent to stderr so the doctests do not see it; since there is an empty line after the line F = pol.factor(), the doctests expected no output to stdout which is what actually happened.

@saraedum
Copy link
Member Author

Author: Julian Rueth

@ppurka
Copy link
Member

ppurka commented Jul 26, 2012

comment:3

Hello, some comments on your patches :)

  1. You can mention class functions in your patches by writing it as :meth:`._factor_univariate_polynomial` instead of writing that as `_factor_univariate_polynomial()`. See this dev doc for more details.
  2. I don't understand why you made all the changes like the one below. I think all these forms of declarations test different ways of calling and/or declaring the rings or variables. Unless I am mistaken, it should be good to leave them alone. Maybe someone who knows the code better can comment.
-            sage: C = ComplexField(100)
-            sage: R.<x> = C[]
+
+            sage: R.<x> = ComplexField(100)[]
             sage: F = factor(x^2+3); F

@saraedum
Copy link
Member Author

comment:4

Thanks for having a look at my patches.

Replying to @ppurka:

  1. You can mention class functions in your patches by writing it as :meth:`._factor_univariate_polynomial` instead of writing that as `_factor_univariate_polynomial()`. See this dev doc for more details.

That makes sense. I will change the docstrings accordingly.

  1. I don't understand why you made all the changes like the one below. I think all these forms of declarations test different ways of calling and/or declaring the rings or variables. Unless I am mistaken, it should be good to leave them alone. Maybe someone who knows the code better can comment.
-            sage: C = ComplexField(100)
-            sage: R.<x> = C[]
+
+            sage: R.<x> = ComplexField(100)[]
             sage: F = factor(x^2+3); F

Ok. If this was indeed intended, then I can of course revert these changes. I just had the feeling that the different constructors should not be tested in the factor() method. When I was new to sage I found such docstrings quite confusing because I wondered if these different constructors had any influence on the code that was actually demonstrated.

@pjbruin
Copy link
Contributor

pjbruin commented Jun 15, 2013

Reviewer: Peter Bruin

@pjbruin
Copy link
Contributor

pjbruin commented Jun 15, 2013

comment:6

trac_13272_docstring.patch no longer applies correctly to Sage 5.10.rc1; can you rebase it?

@pjbruin

This comment has been minimized.

@saraedum
Copy link
Member Author

comment:7

Replying to @pjbruin:

trac_13272_docstring.patch no longer applies correctly to Sage 5.10.rc1; can you rebase it?

Thanks for looking at these tickets. I'm building 5.10 now, will rebase the patch when this is done.

@saraedum
Copy link
Member Author

docstring cleanup

@saraedum
Copy link
Member Author

comment:8

Attachment: trac_13272_docstring.patch.gz

I rebased the patch. It might not apply anymore, since I rebased it against the git repository and used sagedev's export_patch to export it. I'm not sure if the patchbot cares about whitespace since that will most probably be incorrect.

@pjbruin
Copy link
Contributor

pjbruin commented Jun 18, 2013

comment:9

Unfortunately the whitespace matters a lot:

sage: hg_sage.qapplied()
cd "/home/staff/pbruin/src/sage-5.10.rc2/devel/sage" && sage --hg qapplied  
trac_13272_proof.patch
sage: hg_sage.qpush()
cd "/home/staff/pbruin/src/sage-5.10.rc2/devel/sage" && sage --hg qpush  
applying trac_13272_docstring.patch
patching file sage/rings/polynomial/polynomial_element.pyx
Hunk #1 FAILED at 2464
Hunk #2 FAILED at 2504
Hunk #3 FAILED at 2518
Hunk #5 FAILED at 2577
Hunk #6 FAILED at 2598
Hunk #8 FAILED at 2691
Hunk #9 FAILED at 2719
Hunk #10 FAILED at 2741
Hunk #12 FAILED at 2809
Hunk #13 FAILED at 2933
Hunk #14 FAILED at 3020
11 out of 14 hunks FAILED -- saving rejects to file sage/rings/polynomial/polynomial_element.pyx.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh trac_13272_docstring.patch

In the meantime I did manage to rebase the first version of your patch, but even apart from whitespace the resulting patch has several differences with your new patch.

@saraedum
Copy link
Member Author

comment:10

Could you post the rebased patch?

Sorry for bothering you with this but I don't have mercurial sage anymore. I started a thread on sage-git to find out if there is any way to make hg ignore whitespace.

@pjbruin
Copy link
Contributor

pjbruin commented Jun 18, 2013

Attachment: trac_13272_docstring_new.patch.gz

applies to 5.10.rc2, but differs non-trivially from trac_13272_docstring.patch

@pjbruin
Copy link
Contributor

pjbruin commented Jun 18, 2013

comment:11

I tried to find out if hg_sage.qpush() has an option similar to patch --ignore--whitespace, but no luck so far.

@ppurka
Copy link
Member

ppurka commented Jun 18, 2013

comment:12

Please don't ignore whitespace and fuzz. It can lead to patches being inserted in the wrong place in the file.

@saraedum
Copy link
Member Author

comment:13

Replying to @ppurka:

Please don't ignore whitespace and fuzz. It can lead to patches being inserted in the wrong place in the file.

I see your point. However, I think it could help a lot with the testing of the sage-git tools, if one could move patches between these two worlds somehow. It's probably better to move this discussion to https://groups.google.com/forum/?fromgroups#!topic/sage-git/eCPmLRqHR0s

@jdemeyer jdemeyer removed this from the sage-5.11 milestone Aug 13, 2013
@jdemeyer jdemeyer added this to the sage-5.12 milestone Aug 13, 2013
@pjbruin
Copy link
Contributor

pjbruin commented Dec 19, 2013

comment:15

After the switch to Git, I thought it was a good time to come back to this ticket (and the others related to #11731). I converted the two patches into a branch based on Sage 6.0 (to be pushed shortly). I omitted most of the changes in the polynomial constructors (see comment:3) and did not delete the nffactor() test (see comment:1; it does see the stderr output). Furthermore, I made a few small cosmetic fixes. If you are happy with this version, feel free to set it to positive review.

@pjbruin
Copy link
Contributor

pjbruin commented Dec 19, 2013

Branch: u/pbruin/13272-factor_args_doc

@pjbruin
Copy link
Contributor

pjbruin commented Dec 19, 2013

Commit: f63ffd2

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented Jan 9, 2014

Changed reviewer from Peter Bruin to Peter Bruin, Jeroen Demeyer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants