#6106: [with patch, with review, needs work] Additional functions for Indefinite
Binary Quadratic Forms
-----------------------------+----------------------------------------------
Reporter: aliashamieh | Owner: justin
Type: enhancement | Status: new
Priority: minor | Milestone: sage-4.0.2
Component: quadratic forms | Keywords: binary quadratic forms
Reviewer: | Author:
Merged: |
-----------------------------+----------------------------------------------
Comment(by cremona):
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.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6106#comment:2>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---