From 0c5ed5184367c3beedc27c86eb6bec1742c874b4 Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Fri, 23 Feb 2024 12:14:16 +0100 Subject: [PATCH] add riemann theta example to complex_plots --- examples/complex_plot.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/examples/complex_plot.c b/examples/complex_plot.c index 8c2704fcb5..bb37bf7048 100644 --- a/examples/complex_plot.c +++ b/examples/complex_plot.c @@ -7,6 +7,8 @@ #include "acb_hypgeom.h" #include "acb_modular.h" #include "acb_elliptic.h" +#include "acb_mat.h" +#include "acb_theta.h" #include "profiler.h" #include "thread_support.h" @@ -390,6 +392,35 @@ fresnelc(acb_t res, const acb_t z, slong prec) acb_hypgeom_fresnel(NULL, res, z, 0, prec); } +void +riemanntheta(acb_t res, const acb_t z, slong prec) +{ + acb_mat_t tau; + acb_ptr th, t; + + acb_mat_init(tau, 2, 2); + + acb_set_d_d(acb_mat_entry(tau, 0, 0), 1.0, 2.0); + acb_set_d_d(acb_mat_entry(tau, 0, 1), -1.0, -1.0); + acb_set_d_d(acb_mat_entry(tau, 1, 0), -1.0, -1.0); + acb_set_d_d(acb_mat_entry(tau, 1, 1), 1.0, 2.0); + + t = _acb_vec_init(2); + th = _acb_vec_init(16); + + acb_set(t, z); + acb_div_onei(t + 1, z); + acb_mul_2exp_si(t + 1, t + 1, -1); + acb_theta_all(th, t, tau, 0, prec); + acb_set(res, th + 9); + acb_mul_2exp_si(res, res, -2); + + _acb_vec_clear(th, 16); + _acb_vec_clear(t, 2); + + acb_mat_clear(tau); +} + typedef struct { arf_ptr xa; @@ -606,6 +637,8 @@ int main(int argc, char *argv[]) func = fresnels; else if (!strcmp(argv[i], "fresnelc")) func = fresnelc; + else if (!strcmp(argv[i], "riemanntheta")) + func = riemanntheta; else { printf("unknown option: %s\n", argv[i]);