Opened 14 months ago

Closed 6 months ago

Last modified 4 months ago

#14218 closed enhancement (fixed)

height and canonical height for projective points and morphisms

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

Description (last modified by 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 bhutz 14 months ago.
trac_14218_remove_imports.patch (1.4 KB) - added by chapoton 8 months ago.
trac_14218_addon1.patch (57.5 KB) - added by chapoton 6 months ago.
trac_14218_heights.patch (22.5 KB) - added by bhutz 6 months ago.
removed the log import from affine_point.py

Download all attachments as: .zip

Change History (32)

Changed 14 months ago by bhutz

comment:1 Changed 14 months ago by chapoton

  • Dependencies changed from 13130, 14217 to #13130, #14217

comment:2 Changed 13 months ago by bhutz

  • Description modified (diff)
  • Status changed from new to needs_review

comment:3 Changed 12 months ago by chapoton

apply trac_14218_heights.patch

comment:4 Changed 11 months ago by bhutz

apply trac_14218_heights.patch

comment:5 Changed 8 months ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:6 Changed 8 months ago by chapoton

  • Description modified (diff)

comment:7 Changed 8 months ago by chapoton

  • Description modified (diff)

Changed 8 months ago by chapoton

comment:8 Changed 8 months ago by chapoton

new patch, changed the import of copy

comment:9 Changed 8 months ago by bhutz

apply trac_14218_heights.patch trac_14218_remove_imports.patch

comment:10 Changed 7 months ago by jdefaria

  • Reviewers set to Joao Alberto de Faria
  • Status changed from needs_review to needs_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 7 months ago by bhutz

  • Dependencies #13130, #14217 deleted
  • Status changed from needs_work to needs_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 7 months ago by bhutz

apply trac_14218_heights.patch trac_14218_remove_imports.patch

comment:13 Changed 7 months ago by atowsley

  • Status changed from needs_review to needs_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 7 months ago by atowsley (previous) (diff)

comment:14 Changed 7 months ago by bhutz

  • Status changed from needs_work to needs_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 6 months ago by atowsley

  • Status changed from needs_review to positive_review

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

comment:16 Changed 6 months ago by bhutz

  • Reviewers changed from Joao Alberto de Faria to Joao Alberto de Faria, Adam Towsley

comment:17 Changed 6 months ago by jdemeyer

  • Merged in set to sage-5.13.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:18 Changed 6 months ago by jdemeyer

  • Merged in sage-5.13.beta1 deleted
  • Resolution fixed deleted
  • Status changed from closed to new

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 6 months ago by bhutz

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 6 months ago by bhutz

  • Status changed from new to needs_review

Changed 6 months ago by chapoton

comment:21 Changed 6 months ago by 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 6 months ago by jdemeyer

I suggest removing the added

from math import log

(the addon patch removes only 1 out of 2)

Last edited 6 months ago by jdemeyer (previous) (diff)

comment:23 Changed 6 months ago by bhutz

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 6 months ago by bhutz

removed the log import from affine_point.py

comment:24 follow-up: Changed 6 months ago by bhutz

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 6 months ago by jdemeyer

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 6 months ago by atowsley

  • Status changed from needs_review to positive_review

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

comment:27 Changed 6 months ago by jdemeyer

  • Merged in set to sage-5.13.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:28 Changed 4 months ago by jdemeyer

  • Authors changed from Ben Hutz to Benjamin Hutz
Note: See TracTickets for help on using tickets.