Opened 4 years ago

Last modified 22 months ago

#23412 new defect

Quadratic Forms Local Representation Returns Incorrect Output

Reported by: annahaensch Owned by:
Priority: major Milestone: sage-8.1
Component: quadratic forms Keywords: sd87
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

The function is_locally_represented_number_at_place returns the wrong output in at least one case. For the binary form <4,-4> we can see that it integrally represents 44, since 44=4(36)-4(25), so it certainly represents 44 locally at 2. However,

sage: L=DiagonalQuadraticForm(ZZ,[4,-4])
sage: L.is_locally_represented_number_at_place(44,2)
False

This should return True. The same error does not seem to appear at other primes,

sage: L.is_locally_represented_number_at_place(44,5)
True
sage: L.is_locally_represented_number_at_place(44,3)
True

Change History (13)

comment:1 Changed 4 years ago by fli

Duplicate of #20180?

Last edited 4 years ago by fli (previous) (diff)

comment:2 Changed 4 years ago by annahaensch

Yes, I had totally forgotten about that other one. I think this ticket gives a better explanation though.

comment:3 Changed 4 years ago by fli

  • Keywords sd87 added

comment:4 Changed 3 years ago by sbrandhorst

The real bug might be that quadratic form evaluation is broken. See #23977

comment:5 Changed 3 years ago by sbrandhorst

I am sorry the evaluation is not broken. I just got confused with

sage: L=DiagonalQuadraticForm(ZZ,[4,-4])
sage: L.polynomial()
8*x0^2 - 8*x1^2

comment:6 Changed 3 years ago by sbrandhorst

We are not restricted to p=2.

sage: L=DiagonalQuadraticForm(ZZ,[4,-4])
sage: bugs = []
....: for p in primes_first_n(200):
....:     if not L.is_locally_represented_number_at_place(44,p):
....:         bugs.append(p)
....:         
....:     
sage: bugs
[2, 11]

comment:7 Changed 3 years ago by sbrandhorst

sage: ?L.local_representation_conditions

Signature:      L.local_representation_conditions(recompute_flag=False, silent_flag=False)
Docstring:     
   WARNING: THIS ONLY WORKS CORRECTLY FOR FORMS IN >=3 VARIABLES,
      WHICH ARE LOCALLY UNIVERSAL AT ALMOST ALL PRIMES!

comment:8 Changed 3 years ago by sbrandhorst

sage: L.is_locally_represented_number_at_place(12,3)
False

Note that (2^2-1^2)*4 = 12. So the expected answer is True

Last edited 3 years ago by sbrandhorst (previous) (diff)

comment:9 Changed 3 years ago by sbrandhorst

L.local_representation_conditions(11,silent_flag=False)

This 2-dimensional form represents the p-adic integers of even
valuation for all primes p except [2].
For these and the reals, we have:
     Reals:   [0, 0]
     p = 2:   [1, 1, 1, 1, 2, 2, 2, 2]

It does not comment on the primes of odd valuation.

So my current hypothesis is that everything works as long as the valuation is even or the form has rank at least 3. We should also check if degenerate forms are handled.

comment:10 Changed 3 years ago by sbrandhorst

def local_conditions_vector_for_prime(self, p):

    ...
    ...
    elif self.dim == 2:
        if p == 2:
             return [2, 0, 0, 0, 0, infinity, infinity, infinity, infinity]
        else:
            return [p, 0, 0, infinity, infinity, None, None, None, None]

This is certainly a bug.

comment:11 Changed 3 years ago by sbrandhorst

It seems the theory for binary quadratic forms is different as usually. Do you know a good reference for this?

comment:12 Changed 3 years ago by sbrandhorst

sage: D.is_locally_represented_number(44)
False
sage: D

Quadratic form in 3 variables over Integer Ring with coefficients: 
[ 4 0 0 ]
[ * -4 0 ]
[ * * 4 ]

Okay. Let's just say nothing is working.

comment:13 Changed 22 months ago by sbrandhorst

I would recommend to deprecate and remove the function.

Note: See TracTickets for help on using tickets.