File: zeta_rs_bound.c

package info (click to toggle)
flint-arb 1%3A2.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,028 kB
  • sloc: ansic: 177,109; sh: 553; makefile: 288; python: 268
file content (90 lines) | stat: -rw-r--r-- 2,204 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
    Copyright (C) 2016 Fredrik Johansson

    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"

/* Arias de Reyna, Theorem 4.2 */
void
acb_dirichlet_zeta_rs_bound(mag_t err, const acb_t s, slong K)
{
    arb_t a;
    mag_t c1, c2, c3;
    slong e;

    if (!arb_is_positive(acb_imagref(s)) || K < 1 || !acb_is_finite(s))
    {
        mag_inf(err);
        return;
    }

    arb_init(a);

    arb_add_ui(a, acb_realref(s), K, MAG_BITS);
    arb_sub_ui(a, a, 2, MAG_BITS);

    if (!arb_is_nonnegative(acb_realref(s)) && !arb_is_nonnegative(a))
    {
        mag_inf(err);
        arb_clear(a);
        return;
    }

    mag_init(c1);
    mag_init(c2);
    mag_init(c3);

    /* c1 = 1/7 2^(3 sigma / 2)  re(sigma) >= 0 */
    /* c1 < 1/2                  re(sigma) < 0  */
    arf_set_mag(arb_midref(a), arb_radref(acb_realref(s)));
    arf_add(arb_midref(a), arb_midref(a), arb_midref(acb_realref(s)), MAG_BITS, ARF_RND_CEIL);

    if (arf_sgn(arb_midref(a)) <= 0)
    {
        mag_set_ui_2exp_si(c1, 1, -1);
    }
    else if (arf_cmp_2exp_si(arb_midref(a), FLINT_BITS - 4) < 0)
    {
        mag_one(c1);
        mag_div_ui(c1, c1, 7);
        e = arf_get_si(arb_midref(a), ARF_RND_CEIL);
        mag_mul_2exp_si(c1, c1, (3 * e + 1) / 2);
        if (mag_cmp_2exp_si(c1, -1) < 0)
            mag_set_ui_2exp_si(c1, 1, -1);
    }
    else
    {
        mag_inf(c1);
    }

    /* c2 = 1 / ((10/11) sqrt(t/(2pi))) = (11/10) sqrt((2pi)/t) */
    arb_get_mag_lower(c3, acb_imagref(s));
    mag_const_pi(c2);
    mag_mul_2exp_si(c2, c2, 1);
    mag_div(c2, c2, c3);
    mag_sqrt(c2, c2);
    mag_mul_ui(c2, c2, 11);
    mag_div_ui(c2, c2, 10);

    /* c2 = c2^(K+1) */
    mag_pow_ui(c2, c2, K + 1);

    /* c3 = gamma((K+1)/2) */
    mag_fac_ui(c3, K / 2);

    mag_mul(err, c1, c2);
    mag_mul(err, err, c3);

    mag_clear(c1);
    mag_clear(c2);
    mag_clear(c3);
    arb_clear(a);
}