Opened 10 years ago

Closed 9 years ago

Last modified 7 years ago

#14218 closed enhancement (fixed)

height and canonical height for projective points and morphisms

Reported by: Ben Hutz Owned by: Ben Hutz
Priority: major Milestone: sage-5.13
Component: algebraic geometry Keywords: height, canonical, projective, dynamics
Cc: Merged in: sage-5.13.beta2
Authors: Ben Hutz Reviewers: Joao Alberto de Faria, Adam Towsley
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Frédéric Chapoton)

This patch implements height functionality from the initial dynamics functionality problems proposed at the 2012 ICERM semester in Complex and Arithmetic dynamics.

Builds on Trac #13130 and Trac #14217

Implements height functionality:

  • height of points
  • height of morphisms
  • local green's functions
  • canonical heights

Apply:

Attachments (4)

heights.patch (14.4 KB) - added by Ben Hutz 10 years ago.
trac_14218_remove_imports.patch (1.4 KB) - added by Frédéric Chapoton 9 years ago.
trac_14218_addon1.patch (57.5 KB) - added by Frédéric Chapoton 9 years ago.
trac_14218_heights.patch (22.5 KB) - added by Ben Hutz 9 years ago.
removed the log import from affine_point.py

Download all attachments as: .zip

Change History (33)

Changed 10 years ago by Ben Hutz

Attachment: heights.patch added

comment:1 Changed 10 years ago by Frédéric Chapoton

Dependencies: 13130, 14217#13130, #14217

comment:2 Changed 10 years ago by Ben Hutz

Description: modified (diff)
Status: newneeds_review

comment:3 Changed 10 years ago by Frédéric Chapoton

apply trac_14218_heights.patch

comment:4 Changed 10 years ago by Ben Hutz

apply trac_14218_heights.patch

comment:5 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:6 Changed 9 years ago by Frédéric Chapoton

Description: modified (diff)

comment:7 Changed 9 years ago by Frédéric Chapoton

Description: modified (diff)

Changed 9 years ago by Frédéric Chapoton

comment:8 Changed 9 years ago by Frédéric Chapoton

new patch, changed the import of copy

comment:9 Changed 9 years ago by Ben Hutz

apply trac_14218_heights.patch trac_14218_remove_imports.patch

comment:10 Changed 9 years ago by Joao Alberto de Faria

Reviewers: Joao Alberto de Faria
Status: needs_reviewneeds_work

Confirmed that the functions were returning the correct values. Also tested the functions would not accept undefined variables, here are the list of known issues found

projective_point.py:

  • green_function: kwd "precision"in should be "prec"
  • green_function: Joe's name is spelled wrong
  • global_height: lacking both a number field and precision example
  • global_height: description still says ZZ or QQ only
  • canonical_height: lacking a precision example

comment:11 Changed 9 years ago by Ben Hutz

Dependencies: #13130, #14217
Status: needs_workneeds_review

Fixed all the issues described above. The only change of note was that fixing the 'precision' keyword required more than just a rename. The use of the precision needed to be included throughout the green's function computation.

Since that patchbot seems to be trying to apply the patches from the *closed* dependencies #13130 and #14217, I've removed those from the dependency field. Hopefully that will allow the patchbot to test this patch.

comment:12 Changed 9 years ago by Ben Hutz

apply trac_14218_heights.patch trac_14218_remove_imports.patch

comment:13 Changed 9 years ago by Adam Towsley

Status: needs_reviewneeds_work

When computing the height of the constant 0 in a function field global_height gives and error. Every other constant seems fine.

R.<x> = PolynomialRing?(QQ)

A.<x> = AffineSpace?(QQ,1)

H=Hom(A,A)

f=H([0])

f.global_height()

returns

Traceback (most recent call last):

File "<stdin>", line 1, in <module> File "_sage_input_100.py", line 10, in <module>

exec compile(u'open("_code_.py","w").write("# -*- coding: utf-8 -*-
n" + _support_.preparse_worksheet_cell(base64.b64decode("Ui48eD4gPSBQb2x5bm9taWFsUmluZyhRUSkKQS48eD4gPSBBZmZpbmVTcGFjZShRUSwxKQpIPUhvbShBLEEpCmY9SChbMF0pCmYuZ2xvYmFsX2hlaWdodCgp"),globals())+"
n"); execfile(os.path.abspath("_code_.py"))

File "", line 1, in <module>

File "/tmp/tmpYiF_cn/_code_.py", line 7, in <module>

exec compile(u'f.global_height()

File "", line 1, in <module>

File "/home/atowsley/sage-5.12.rc0/local/lib/python2.7/site-packages/sage/schemes/affine/affine_morphism.py", line 542, in global_height

h=max([c.global_height(prec) for c in C])

ValueError?: max() arg is an empty sequence

Last edited 9 years ago by Adam Towsley (previous) (diff)

comment:14 Changed 9 years ago by Ben Hutz

Status: needs_workneeds_review

Yes, missed that case. Actually, in any dimension if any one of the coordinate functions is 0 it has the same issue. The new patches catches those.

apply trac_14218_heights.patch trac_14218_remove_imports.patch

comment:15 Changed 9 years ago by Adam Towsley

Status: needs_reviewpositive_review

I found no more issues. It passed the long test.

comment:16 Changed 9 years ago by Ben Hutz

Reviewers: Joao Alberto de FariaJoao Alberto de Faria, Adam Towsley

comment:17 Changed 9 years ago by Jeroen Demeyer

Merged in: sage-5.13.beta1
Resolution: fixed
Status: positive_reviewclosed

comment:18 Changed 9 years ago by Jeroen Demeyer

Merged in: sage-5.13.beta1
Resolution: fixed
Status: closednew

Sorry, but this needs work:

there are numerical precision issues on Solaris with green_function:

**********************************************************************
File "devel/sage/sage/schemes/projective/projective_morphism.py", line 1236, in sage.schemes.projective.projective_morphism.SchemeMorphism_polynomial_projective_space.green_function
Failed example:
    f.green_function(P.point([5,2],False),0,N=30)
Expected:
    1.7315451844777406965714211646
Got:
    1.7315451844777406965172110560
**********************************************************************
File "devel/sage/sage/schemes/projective/projective_morphism.py", line 1238, in sage.schemes.projective.projective_morphism.SchemeMorphism_polynomial_projective_space.green_function
Failed example:
    f.green_function(P.point([2,1],False),0,N=30)
Expected:
    0.86577259223181085968927265240
Got:
    0.86577259223181085966216759809
**********************************************************************
File "devel/sage/sage/schemes/projective/projective_morphism.py", line 1240, in sage.schemes.projective.projective_morphism.SchemeMorphism_polynomial_projective_space.green_function
Failed example:
    f.green_function(P.point([1,1],False),0,N=30)
Expected:
    0.43288629610862337434550672337
Got:
    0.43288629610862337433195419621
**********************************************************************
File "devel/sage/sage/schemes/projective/projective_point.py", line 727, in sage.schemes.projective.projective_point.SchemeMorphism_point_projective_ring.green_function
Failed example:
    Q.green_function(f,0,N=200,prec=200)
Expected:
    1.6460930160038721221892751679783564477424287857689424150860
Got:
    1.6460930160038721221892751679783564477424287857689424150656
**********************************************************************

This actually shows a bigger problem: it shows that some computations depend on machine floats and therefore are done only to 53 bits precision. In the code I see:

RealField(prec)(log(m))

this should be

RealField(prec)(m).log()

(the best solution to avoid this is simply removing from math import log)

Also, I recommend you to write once

R = RealField(prec)

and then use R(a) every where.

Also, comparisons to None should be done with is: a is None or a is not None.

comment:19 Changed 9 years ago by Ben Hutz

apply trac_14218_heights.patch trac_14218_remove_imports.patch

Removed the math.log function and replaced with R.log() everywhere it occurred. That should fix the precision issue.

Fixed comparisons to None everywhere they occurred.

Also, added another input check to the error_bound kwd.

comment:20 Changed 9 years ago by Ben Hutz

Status: newneeds_review

Changed 9 years ago by Frédéric Chapoton

Attachment: trac_14218_addon1.patch added

comment:21 Changed 9 years ago by Frédéric Chapoton

Description: modified (diff)

Hello,

I have added a patch which mainly cleans the doc a little bit.

for the patchbot:

apply trac_14218_heights.patch trac_14218_remove_imports.patch trac_14218_addon1.patch

By the way, did you know that you could run your own patchbot on your own tickets instead of waiting for the bot of someone else ?

comment:22 Changed 9 years ago by Jeroen Demeyer

I suggest removing the added

from math import log

(the addon patch removes only 1 out of 2)

Last edited 9 years ago by Jeroen Demeyer (previous) (diff)

comment:23 Changed 9 years ago by Ben Hutz

Yes, thanks, I'll upload a new version that gets the missed one in affine_point.py as soon as my tests are done.

Changed 9 years ago by Ben Hutz

Attachment: trac_14218_heights.patch added

removed the log import from affine_point.py

comment:24 Changed 9 years ago by Ben Hutz

apply trac_14218_heights.patch trac_14218_remove_imports.patch trac_14218_addon1.patch

all I have to say is that I can't wait to switch to git instead of dealing with a stack of patches like this...

comment:25 in reply to:  24 Changed 9 years ago by Jeroen Demeyer

Replying to bhutz:

all I have to say is that I can't wait to switch to git instead of dealing with a stack of patches like this...

It is perfectly fine to fold all patches into one patch.

comment:26 Changed 9 years ago by Adam Towsley

Status: needs_reviewpositive_review

Green's function works and is accurate on my computer.

comment:27 Changed 9 years ago by Jeroen Demeyer

Merged in: sage-5.13.beta2
Resolution: fixed
Status: positive_reviewclosed

comment:28 Changed 9 years ago by Jeroen Demeyer

Authors: Ben HutzBenjamin Hutz

comment:29 Changed 7 years ago by Frédéric Chapoton

Authors: Benjamin HutzBen Hutz
Note: See TracTickets for help on using tickets.