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

Implement Riemann theta functions #6371

Open
ncalexan mannequin opened this issue Jun 20, 2009 · 65 comments
Open

Implement Riemann theta functions #6371

ncalexan mannequin opened this issue Jun 20, 2009 · 65 comments

Comments

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Jun 20, 2009

In the theory of differential equations and Abelian varieties, Riemann theta functions and their relatives play an important role. Implement these in Sage!

See also:

  • RiemannTheta --
    A Sagemath package for evaluating Riemann theta functions
    with characteristics numerically to arbitrary precision,
    as well as their derivatives

CC: @cswiercz @fredrik-johansson @mstreng @jpflori @slel

Component: numerical

Keywords: riemann theta klein

Author: Nick Alexander, Chris Swierczewski

Branch/Commit: u/chapoton/6371 @ 0342ce9

Reviewer: Marco Streng, Bernard Deconinck

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

@ncalexan ncalexan mannequin added c: numerical labels Jun 20, 2009
@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Jun 20, 2009

Attachment: trac_6371-riemann-theta.patch.gz

@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Jun 20, 2009

comment:1

I want to make sure this code doesn't get lost. It's very much [needs work] -- I don't think all tests are tagged optional and long correctly. I'm not certain that the output is correct to very high accuracy, either -- magma and mathematica disagree, and maple is too slow to evaluate to high precision.

Fredrik, somewhere in here there are lots of calls to the incomplete gamma function. I used low precision as much as possible as you will see, because I don't really need high precision, I just need large outputs.

Chris, this applies against 4.0.2.alpha1 at least. Documentation and testing appreciated!

@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Jun 20, 2009

comment:2

Marco, you might be interested in this work in progress code too.

@fredrik-johansson
Copy link
Contributor

comment:3

Is double precision sufficient? Are the arguments large, integers or half-integers? In either case, very fast evaluation of the incomplete gamma function should be possible.

@williamstein
Copy link
Contributor

comment:4

To use this, type

sage: hg_sage.apply('https://github.com/sagemath/sage-prod/files/10645258/trac_6371-riemann-theta.patch.gz')
sage: quit

sage -br

sage: now you have the new code

@cswiercz cswiercz mannequin assigned cswiercz and unassigned sagetrac-jkantor Dec 10, 2010
@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Dec 10, 2010

comment:6

Over the past month or two I've done considerable work vetting out the bugs and errors in the above code. Within a week or so I hope to post a replacement patch. Hence, the change of owner. I'll keep everyone who's interested posted on my progress.

A word of warning, though: since I know a lot of people who are interested in my getting Riemann theta into Sage as soon as possible I had to strip Shimura phi, Siegel theta, and Klein P. I'm not qualified to review / bug fix that part of the code. I hope this is okay with the original authors and people who are interested in seeing this patch resolved. Perhaps we can move these implementations into a new patch once Riemann theta is implemented.

Again, I'll be posting a replacement patch sometime within the next two weeks or so.

@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Dec 10, 2010

comment:7

A word of warning, though: since I know a lot of people who are interested in my getting Riemann theta into Sage as soon as possible I had to strip Shimura phi, Siegel theta, and Klein P. I'm not qualified to review / bug fix that part of the code. I hope this is okay with the original authors and people who are interested in seeing this patch resolved.

I am the original author, and I think this is a very reasonable decision! You should know that I use "Siegel theta" and "Riemann theta" interchangeably. Riemann theta often seems to mean just with characteristics (0, 0, ..., 0) and Siegel theta seems to be a Mathematica-ism. Whatever we decide on is (probably) fine by me.

Perhaps we can move these implementations into a new patch once Riemann theta is implemented.

These bits are interesting for my research, but probably are not all that interesting more generally. Cut them for now.

Thanks for you efforts, Chris!

@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Dec 10, 2010

comment:8

I am the original author, and I think this is a very reasonable decision! You should know that I use "Siegel theta" and "Riemann theta" interchangeably. Riemann theta often seems to mean just with characteristics (0, 0, ..., 0) and Siegel theta seems to be a Mathematica-ism. Whatever we decide on is (probably) fine by me.
Thanks for you efforts, Chris!

Huzzah! Thank _you_ for your help!

@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 25, 2011

Attachment: trac_6371-riemann-theta-REPLACEMENT.patch.gz

Replacement for first patch by ncalexan

@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 25, 2011

Changed author from Nick Alexander to Nick Alexander, cswiercz

@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 25, 2011

comment:9

Note that the second patch is meant to replace the first. Many many changes were made!

@cswiercz cswiercz mannequin added s: needs review and removed s: needs work labels Mar 25, 2011
@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 28, 2011

comment:10

Some clarifications and fine tuning needs to be made to the documentation.

@cswiercz cswiercz mannequin changed the title implement Riemann theta functions Implement Riemann theta functions Mar 28, 2011
@cswiercz cswiercz mannequin added s: needs work and removed s: needs review labels Mar 28, 2011
@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 28, 2011

Part 2 of the replacement patch. Includes documentation fixes.

@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 28, 2011

comment:11

Attachment: trac_6371-riemann-theta-REPLACEMENT-PART2.patch.gz

@cswiercz cswiercz mannequin added s: needs review and removed s: needs work labels Mar 28, 2011
@cswiercz
Copy link
Mannequin

cswiercz mannequin commented Mar 28, 2011

Attachment: trac_6371_riemann-theta-REPLACEMENT-PART3.patch.gz

Minor last-minute bug.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton
Copy link
Contributor

comment:39

I made a git branch from the patches, but it does not work. I have not tried to
find where problems are.


New commits:

403854bAdded Riemann theta functions to Sage.
ff08d10Minor doctest issues resolved with riemann_theta.py.
3d0a00cFixed additional errors with docstrings and symmetric Riemann matrix testing.
afacea6trac #6371 code cleanup

@fchapoton
Copy link
Contributor

Branch: u/chapoton/6371

@fchapoton
Copy link
Contributor

Commit: afacea6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 10, 2015

Changed commit from afacea6 to 5caa1ec

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 10, 2015

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

5caa1ectrac #6371 ref links

@fchapoton fchapoton modified the milestones: sage-6.4, sage-7.0 Jan 6, 2016
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 18, 2016

Changed commit from 5caa1ec to 696b994

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 18, 2016

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

72a17d9Merge branch 'u/chapoton/6371' into 7.1.b3
5e44969trac #6371 partial correction, tolerance added
696b994trac #6371 details

@fchapoton

This comment has been minimized.

@fchapoton fchapoton modified the milestones: sage-7.0, sage-7.1 Feb 19, 2016
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 10, 2016

Changed commit from 696b994 to d552509

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 10, 2016

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

d552509Merge branch 'u/chapoton/6371' into 7.3.b3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 11, 2016

Changed commit from d552509 to 4575a7b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 11, 2016

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

4575a7bMerge branch 'u/chapoton/6371' in 7.3.b7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 8, 2017

Changed commit from 4575a7b to 5fd3c60

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 8, 2017

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

5fd3c60Merge branch 'u/chapoton/6371' in 8.0.b9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 11, 2018

Changed commit from 5fd3c60 to 0342ce9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 11, 2018

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

0342ce9Merge branch 'u/chapoton/6371' in 8.2.b8

@nbruin
Copy link
Contributor

nbruin commented Feb 25, 2021

comment:48

A student will be doing a summer project towards getting Riemann theta functions, their directional derivatives, and characteristics into sage. Can we repurpose this ticket for that?

@fchapoton
Copy link
Contributor

comment:49

sure, good luck

@mstreng
Copy link
Contributor

mstreng commented Feb 27, 2021

comment:50

sounds good to me

@slel

This comment has been minimized.

@nbruin
Copy link
Contributor

nbruin commented Sep 26, 2021

comment:52

The work is done:

https://github.com/nbruin/RiemannTheta

I have for now published it as a separate pip-able package in the hope that makes it easier for non-sage developers to install it, use it, and comment on it, but eventually the proper place is probably within sage (it's not a lot of code and it's tightly bound to a lot of sage-specific functionality). So the question prior to making a branch for inclusion into sage:

  • functionality and correctness checks. We tried to be careful, but testing generally needs to be done by other people too to get a good idea of how the code performs more generally
  • where to put it into sage? (sage.numerical would be appropriate, or we could place it next to riemann_surfaces because theoretically that's what it's close too -- although of course theta functions are properties of complex lattices, not particularly of Riemann surfaces.
  • do riemann_theta and siegel_reduction go in the same spot?

Also, once it's in, where/how do we expose the functionality in the global namespace (if at all)? Note that the design is a little less ambitious than the cswiercz and no attempt is made to have an SR wrapper of the numerical tool. It does have the big advantage that, as far as I know, the code produces answers of the accuracy one can reasonably expect and does so with reasonable efficiency.

@mkoeppe mkoeppe removed this from the sage-7.1 milestone Dec 29, 2022
@kh-abd-kh
Copy link

kh-abd-kh commented Jun 2, 2024

There is a need for another Riemann Theta (RT) beyond nbruin (nRT) because:
a) nRT being based on multi-precession float point, is expensive . It does not go beyond
g=6. It becomes too slow.

b) for "Physics Applications", all what is needed a fast theta. For plotting 10^-3 is as good as 10^-100

c) Having a fast theta will open for us new roads to have better understanding of Abelian Varieties and their Jacobians.
This subject was the main point of research for the 19' century (183*-19**) From Jacobi to
Coble(191*)/Scorza(191*)/Lefschetz(192*)/Zariski(1929)

d) It is ESSENTIAL for laptops. If it is possible then why not?!. Third world researchers have no
access to fast machines. We should serve them whenever possible.

e) "If GOD had created one single function then it is the Riemann Theta." (Fanatic)

Actually, We might need four new implementation RT.

  1. Float point 64bits.
  2. Float point 32bits.
  3. GPU Theta (Optimal)
  4. Fully parallel Theta that can be distributed cpu(Dask+Vaex) or gpu(Dask+cuDF)

The main implementation is to optimize the algorithm

(based on M. Heil, Numerical tools for the study of finite gap solutions of integrable systems, Ph.D.
thesis, Technischen Universit¨at Berlin, 1995)

=Maple code=
RiemannTheta
Author: Bernard Deconinck (2001).
Modifications by Mark van Hoeij.

=python code=

  • Chris Swierczewski (@cswiercz) - September 2012, July 2016
  • Grady Williams (@gradyrw) - October 2012
  • Jeremy Upsal (@jupsal) - July 2016

The main modification is to initialize the data out of the RT.

I have 1) 2) and partial 3) not yet optimal. (Cupy sXs, and optimal gpu is not just cuda kernels)
"4)" is quite interesting and not impossible the "21-th century" RT.

Khaled/Heliopolis/Cairo.

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

9 participants