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

Add a function "isometry" to the quadratic forms package. #19112

Closed
sagetrac-tgaona mannequin opened this issue Aug 30, 2015 · 76 comments
Closed

Add a function "isometry" to the quadratic forms package. #19112

sagetrac-tgaona mannequin opened this issue Aug 30, 2015 · 76 comments

Comments

@sagetrac-tgaona
Copy link
Mannequin

sagetrac-tgaona mannequin commented Aug 30, 2015

Adds a function "isometry" that returns an isometry from one rational quadratic form to another, provided that it exists.

CC: @annahaensch @sagetrac-tgaona

Component: quadratic forms

Keywords: isometry

Author: Tyler Gaona, Simon Brandhorst

Branch: ffa5295

Reviewer: Simon Brandhorst

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

@sagetrac-tgaona sagetrac-tgaona mannequin added this to the sage-6.9 milestone Aug 30, 2015
@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 1, 2015

Branch: u/tgaona/ticket/19112

@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 1, 2015

New commits:

0d32f4bImplements a method to compute isometries between positive definite quadratic forms.
9e211feAdds a flag parameter to short_vector_list_up_to_length to pass to PARI's

@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 1, 2015

Commit: 9e211fe

@jdemeyer
Copy link

jdemeyer commented Nov 2, 2015

Changed work issues from needs implementation to none

@jdemeyer
Copy link

jdemeyer commented Nov 2, 2015

comment:3

This looks like it reinvents the already-existing method is_globally_equivalent_to. What does your code add?

@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 3, 2015

comment:4

Hi Jeroen,

Sorry for the slow response. This method should be able to return isometries for forms over fields, where I believe is_globally_equivalent_to just works over the ring of integers. For example:

sage: Q = DiagonalQuadraticForm(QQ, [1, 5])
sage: F = QuadraticForm(QQ, 2, [1, 12, 81])
sage: Q.is_globally_equivalent_to(F)
False
sage: Q.is_rationally_isometric(F)
True
sage: T = Q.isometry(F)
sage: T
[  1  -2]
[  0 1/3]
sage: Q.Gram_matrix() == T.transpose() * F.Gram_matrix() * T
True

So Q is equivalent to F over the rationals, but is_globally_equivalent_to doesn't recognize this. This method was intended to complement the is_rationally_isometric method, so perhaps it should be refactored to work in a similar manner as is_globally_equivalent_to, i.e, adding an optional flag to is_rationally_isometric to return the transition matrix for the isometry.

@jdemeyer
Copy link

jdemeyer commented Nov 4, 2015

comment:5

Right, I think it's better to mention this more clearly in the documentation (I always get confused when quadratic-form people talk about isomorphic/isometric/equivalent, I never know what they mean).

@jdemeyer
Copy link

jdemeyer commented Nov 4, 2015

comment:6

That being said, I think you are really over-complicating the algorithm.

Suppose one of the forms is given by the diagonal 5*x0^2 + .... Then really all you need to do in the first step is to find a vector v of "length" 5. This can be done with some algorithm based on PARI's qfsolve(): the only issue is that qfsolve() finds a projective point, but you really want an affine point.

So I suggest to do the following:

  1. implement an affine version of qfsolve() to solve equations of the form Q(x) = C where Q is a quadratic form and C is a constant. Do this in a separate Sage ticket.
  2. use this new function to implement isometry on this ticket.

This will have several major advantages:

  1. your code will be a lot faster.
  2. it will no longer run forever if there is isometry (which is unacceptable).
  3. you can remove the assumption that your quadratic form is positive-definite.

@jdemeyer
Copy link

jdemeyer commented Nov 4, 2015

comment:7

Also, your branch is based on an old version of Sage. You should really develop from the latest beta version (currently 6.10.beta2).

@jdemeyer
Copy link

jdemeyer commented Nov 4, 2015

comment:8

Please follow http://doc.sagemath.org/html/en/developer/coding_basics.html#documentation-strings for the correct formatting of docstrings.

@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 4, 2015

comment:10

I will make it more clear in the documentation that the method returns a transformation matrix, as opposed to saying it returns an isometry.

As to your second point, I agree that a cleaner, more efficient replacement for the first step of the algorithm is very desirable. However, I have looked at the source for PARI's qfsolve() and it isn't clear to me how to adapt it to return an affine vector x such that Q(x) = C. I would appreciate it if you could offer more guidance here, otherwise, I'm not sure how to proceed.

  1. it will no longer run forever if there is isometry (which is unacceptable).

I can fix this by throwing an exception when is_rationally_isometric() returns false for the two forms. The reason I didn't include this initially is that I was working off of Sage 6.8 but is_rationally_isometric() was added in 6.9.

I will fix the formatting in the docstring.

@jdemeyer
Copy link

jdemeyer commented Nov 5, 2015

Dependencies: #18669

@jdemeyer
Copy link

jdemeyer commented Nov 5, 2015

comment:11

Given that your new functionality relies on rational_diagonal_form(), it would be a lot better in fact to base your patch on top of #18669.

@jdemeyer
Copy link

jdemeyer commented Nov 5, 2015

comment:12

About solving quadratic forms:

Suppose you want to solve Q(x) = c. Consider the quadratic form Q(x) - c*z^2 = 0, where z is an extra variable. Find a solution (x,z) to this quadratic form using qfsolve().

Case 1: If z != 0, then Q(x/z) = c.

Case 2: We found a solution Q(x) = 0. Let e be any vector such that B(x,e) != 0, where B is the bilinear form corresponding to Q. To find e, just try all unit vectors (0,..0,1,0...0). Let a = (c - Q(e))/B(x,e) and let y = e + a*x. Then Q(y) = c.

It would be great if you could implement this on a separate ticket.

@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 6, 2015

Changed dependencies from #18669 to #18669 #19533

@sagetrac-tgaona
Copy link
Mannequin Author

sagetrac-tgaona mannequin commented Nov 6, 2015

comment:13

Thanks for the clear explanation. I've opened up a separate ticket for this, and will address the various changes you've suggested.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Changed commit from 9e211fe to afcd21b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

51ba9f8Adds isometry method for quadratic forms.
afcd21bMerge branch 'research' into ticket/19112

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 12, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

8a040f3Merge branch 'develop' into ticket/19112

@simonbrandhorst

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented May 28, 2019

comment:56

the patchbot results look OK (apart from pyflake plugin, which might tell you how to improve the code).

@dimpase dimpase modified the milestones: sage-7.1, sage-8.8 May 28, 2019
@embray
Copy link
Contributor

embray commented Jun 14, 2019

comment:57

Tickets still needing working or clarification should be moved to the next release milestone at the soonest (please feel free to revert if you think the ticket is close to being resolved).

@embray embray modified the milestones: sage-8.8, sage-8.9 Jun 14, 2019
@embray
Copy link
Contributor

embray commented Dec 30, 2019

comment:58

Ticket retargeted after milestone closed

@embray embray modified the milestones: sage-8.9, sage-9.1 Dec 30, 2019
@mkoeppe
Copy link
Member

mkoeppe commented Apr 14, 2020

comment:59

Batch modifying tickets that will likely not be ready for 9.1, based on a review of the ticket title, branch/review status, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.1, sage-9.2 Apr 14, 2020
@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Sep 5, 2020
@simonbrandhorst
Copy link

Changed branch from u/tgaona/ticket/19112 to u/sbrandhorst/ticket/19112

@simonbrandhorst
Copy link

Changed commit from 2b394f4 to ffa5295

@simonbrandhorst
Copy link

New commits:

cb76909Merge branch 'develop' into t/19112/ticket/19112
ffa5295is_rationally_equivalent_to cleanup

@simonbrandhorst
Copy link

Changed author from Tyler Gaona to Tyler Gaona, Simon Brandorst

@simonbrandhorst
Copy link

comment:63

I guess my contribution counts as a reviewer patch...

@vbraun
Copy link
Member

vbraun commented Nov 7, 2020

Changed branch from u/sbrandhorst/ticket/19112 to ffa5295

@mkoeppe
Copy link
Member

mkoeppe commented May 9, 2021

Changed author from Tyler Gaona, Simon Brandorst to Tyler Gaona, Simon Brandhorst

@mkoeppe
Copy link
Member

mkoeppe commented May 9, 2021

Changed commit from ffa5295 to none

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

6 participants