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

Extra doctests for indefinite binary quadratic forms #6106

Closed
sagetrac-aliashamieh mannequin opened this issue May 21, 2009 · 26 comments
Closed

Extra doctests for indefinite binary quadratic forms #6106

sagetrac-aliashamieh mannequin opened this issue May 21, 2009 · 26 comments

Comments

@sagetrac-aliashamieh
Copy link
Mannequin

sagetrac-aliashamieh mannequin commented May 21, 2009

Extra doctests for indefinite binary quadratic forms

CC: @ncalexan

Component: quadratic forms

Keywords: binary quadratic forms

Author: Alia Hamieh

Branch/Commit: 9af692e

Reviewer: John Cremona, Nick Alexander, Simon Brandhorst

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

@sagetrac-aliashamieh
Copy link
Mannequin Author

sagetrac-aliashamieh mannequin commented May 21, 2009

Attachment: 6106binaryQuadratic.patch.gz

Attachment: 6106binaryQuadraticPT2.patch.gz

added missing doctests

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jun 10, 2009

comment:1

Am changing this from "need review" to "needs review" so it shows up in the standard queries

@loefflerd loefflerd mannequin changed the title [need review] Addition Indefinite Binary Quadratic Forms Addition Indefinite Binary Quadratic Forms Jun 10, 2009
@loefflerd loefflerd mannequin added s: needs review and removed s: needs work labels Jun 10, 2009
@JohnCremona
Copy link
Member

comment:2

Review

The patch applied fine to 4.0.1, and it provides some functions which look useful.

I think that not all new new functions have doctests. Why are the new functions not implemented as member functions of the BinaryQF class? That would be much better; as it is anyone using them has to import them explicitly. So I suggest that they are converted to be member functions (which is trivial to do).

Secondly, the use of the python math functions sqrt and floor is not a good idea, since the coefficients of the form will be Sage integers. For example:

sage: from sage.quadratic_forms.binary_qf import normalized_indefinite_form
sage: f = BinaryQF([10^100,10^500,10^200])
sage: f.discriminant()>0
True
sage: normalized_indefinite_form(f)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)

/home/john/.sage/temp/ubuntu/9768/_home_john__sage_init_sage_0.py in <module>()

/home/john/sage-4.0.1/local/lib/python2.5/site-packages/sage/quadratic_forms/binary_qf.pyc in normalized_indefinite_form(f)
    486         raise ValueError, "This only works for indefinite forms"
    487     
--> 488     if sqrt(delta) <= abs(a):
    489         s=(a/abs(a))*floor(-1*b/(2*abs(a)))
    490     else:

OverflowError: math range error

For example, the line if sqrt(delta) <= abs(a): could be replaced by if delta <= a**2: .

The docstring for this function should also say what the definition of "normalised" is.

I also slightly amended the ticket's title to give a better description.

@JohnCremona JohnCremona changed the title Addition Indefinite Binary Quadratic Forms [with review] Additional functions for Indefinite Binary Quadratic Forms Jun 11, 2009
@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Jul 1, 2009

comment:3

Alia and I are going to work on this in the next few days.

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Jul 1, 2009

Reviewer: John Cremona, Nick Alexander

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Jul 1, 2009

Author: Alia Hamieh

@ncalexan ncalexan mannequin changed the title [with review] Additional functions for Indefinite Binary Quadratic Forms Additional functions for Indefinite Binary Quadratic Forms Jul 1, 2009
@sagetrac-aliashamieh
Copy link
Mannequin Author

sagetrac-aliashamieh mannequin commented Jul 17, 2009

Attachment: 6106BinaryQF.patch.gz

[with patch, needs review] Additional functions for Indefinite Binary Quadratic Forms

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@pjbruin
Copy link
Contributor

pjbruin commented Feb 26, 2014

comment:6

This ticket seems to implement the same functionality as (part of) #4120, which has been inactive for a very long time, like this ticket.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@pjbruin
Copy link
Contributor

pjbruin commented Jun 19, 2018

comment:9

Replying to @pjbruin:

This ticket seems to implement the same functionality as (part of) #4120, which has been inactive for a very long time, like this ticket.

Now that #4120 has been merged, it would be good to check if this ticket still adds new functionality. If not, we could also just add the examples from this ticket.

@simonbrandhorst
Copy link

comment:10

This ticket does not add anything new.

@pjbruin
Copy link
Contributor

pjbruin commented Jul 16, 2018

comment:11

Replying to @simonbrandhorst:

This ticket does not add anything new.

OK. It might still be useful to add the doctests from this ticket; what do you think?

@simonbrandhorst
Copy link

comment:12

If I recall correctly the reduction of an indefinite form is not unique but instead we get a cycle of forms. So we can add some doctests. But the results may be different.

Note that we messed up a little for indefinite forms of square determinant #25861.

@pjbruin
Copy link
Contributor

pjbruin commented Jul 16, 2018

Commit: 9af692e

@pjbruin
Copy link
Contributor

pjbruin commented Jul 16, 2018

Branch: u/pbruin/6106-BinaryQF_examples

@pjbruin
Copy link
Contributor

pjbruin commented Jul 16, 2018

comment:13

Here are some doctests from the patches. I checked that they are mathematically correct. The docstring for reduced_form() did not have any examples with transformation=True yet; now it does.

@pjbruin
Copy link
Contributor

pjbruin commented Jul 16, 2018

Changed reviewer from John Cremona, Nick Alexander to John Cremona, Nick Alexander, Simon Brandhorst, Peter Bruin

@pjbruin pjbruin added this to the sage-8.4 milestone Jul 16, 2018
@simonbrandhorst
Copy link

Changed commit from 9af692e to none

@simonbrandhorst
Copy link

comment:14

doc builds.

@simonbrandhorst
Copy link

Changed branch from u/pbruin/6106-BinaryQF_examples to none

@simonbrandhorst
Copy link

Changed reviewer from John Cremona, Nick Alexander, Simon Brandhorst, Peter Bruin to John Cremona, Nick Alexander, Simon Brandhorst

@simonbrandhorst

This comment has been minimized.

@simonbrandhorst simonbrandhorst changed the title Additional functions for Indefinite Binary Quadratic Forms Extra doctests for indefinite binary quadratic forms Jul 16, 2018
@pjbruin
Copy link
Contributor

pjbruin commented Aug 22, 2018

Commit: 9af692e

@pjbruin
Copy link
Contributor

pjbruin commented Aug 22, 2018

comment:16

Replying to @simonbrandhorst:

doc builds.

From your other changes, it doesn't look like you really intended to delete the branch and change the milestone to sage-duplicate/invalid/wontfix...

@pjbruin
Copy link
Contributor

pjbruin commented Aug 22, 2018

Branch: u/pbruin/6106-BinaryQF_examples

@pjbruin pjbruin added this to the sage-8.4 milestone Aug 22, 2018
@simonbrandhorst
Copy link

comment:17

Ooops indeed. Thank you.

@vbraun
Copy link
Member

vbraun commented Aug 25, 2018

Changed branch from u/pbruin/6106-BinaryQF_examples to 9af692e

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