arb/acb_dirichlet/test/t-thetanull.c

120 lines
3.2 KiB
C
Raw Normal View History

2016-09-06 15:43:12 +02:00
/*
Copyright (C) 2016 Pascal Molin
2016-09-06 15:43:12 +02:00
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "acb_dirichlet.h"
int main()
{
2016-04-05 11:55:04 +02:00
slong prec = 64;
ulong q;
2016-03-29 14:04:08 +01:00
flint_printf("thetanull....");
fflush(stdout);
/* check the only theta functions
* theta(chi) = sum chi(k)* k^odd * exp(-Pi * k^2 / q)
* vanishing at 1 correspond to two specific
* characters of moduli 300 and 600 + conjugates
*/
2016-04-05 11:55:04 +02:00
for (q = 3; q < 1000; q ++)
{
2016-10-06 14:19:39 +02:00
dirichlet_group_t G;
dirichlet_char_t chi;
ulong * v, nv, k;
2016-09-02 16:09:18 +02:00
acb_t sum;
acb_ptr z;
arb_t eq;
arb_ptr t, kt, tt;
if (q % 4 == 2)
2016-04-05 11:55:04 +02:00
/* no primitive character mod q */
continue;
2016-10-06 14:19:39 +02:00
dirichlet_group_init(G, q);
dirichlet_char_init(chi, G);
z = _acb_vec_init(G->expo);
_acb_vec_unit_roots(z, G->expo, prec);
2016-04-12 15:07:04 +02:00
nv = acb_dirichlet_theta_length_d(q, 1, prec);
v = flint_malloc(nv * sizeof(ulong));
arb_init(eq);
arb_const_pi(eq, prec);
arb_div_ui(eq, eq, q, prec);
arb_neg(eq, eq);
arb_exp(eq, eq, prec);
t = _arb_vec_init(nv);
acb_dirichlet_arb_quadratic_powers(t, nv, eq, prec);
kt = _arb_vec_init(nv);
for (k = 1; k < nv; k++)
arb_mul_ui(kt + k, t + k, k, prec);
/* theta function on primitive characters */
acb_init(sum);
2016-10-06 14:19:39 +02:00
dirichlet_char_first_primitive(chi, G);
do {
2016-10-08 17:22:19 +02:00
acb_zero(sum);
dirichlet_chi_vec(v, G, chi, nv);
2016-10-08 17:22:19 +02:00
tt = dirichlet_parity_char(G, chi) ? kt : t;
2016-03-29 14:04:08 +01:00
for (k = 1; k < nv; k++)
2016-10-06 14:19:39 +02:00
if (v[k] != DIRICHLET_CHI_NULL)
2016-10-08 17:22:19 +02:00
acb_addmul_arb(sum, z + v[k], tt + k, prec);
2016-10-08 17:22:19 +02:00
if ((q == 300 && (chi->n == 71 || chi->n == 131))
|| (q == 600 && (chi->n == 11 || chi->n == 491)))
{
if (!acb_contains_zero(sum))
{
2016-10-08 17:22:19 +02:00
flint_printf("FAIL: Theta(chi_%wu(%wu))=", q, chi->n);
acb_printd(sum, 10);
flint_printf("\n");
2016-10-06 14:19:39 +02:00
dirichlet_char_print(G, chi);
2016-06-17 18:23:48 +02:00
flint_printf("\n");
abort();
}
}
else if (acb_contains_zero(sum))
{
2016-10-08 17:22:19 +02:00
flint_printf("FAIL: Theta(chi_%wu(%wu))=", q, chi->n);
acb_printd(sum, 10);
flint_printf("\n");
2016-10-06 14:19:39 +02:00
dirichlet_char_print(G, chi);
2016-06-17 18:23:48 +02:00
flint_printf("\n");
abort();
}
2016-10-06 14:19:39 +02:00
} while (dirichlet_char_next_primitive(chi, G) >= 0);
_acb_vec_clear(z, G->expo);
2016-09-09 22:20:10 +02:00
_arb_vec_clear(kt, nv);
_arb_vec_clear(t, nv);
acb_clear(sum);
arb_clear(eq);
2016-04-05 11:55:04 +02:00
flint_free(v);
2016-10-06 14:19:39 +02:00
dirichlet_group_clear(G);
dirichlet_char_clear(chi);
}
flint_cleanup();
flint_printf("PASS\n");
return EXIT_SUCCESS;
}