File: platt_lemma_A11.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 (200 lines) | stat: -rw-r--r-- 4,170 bytes parent folder | download | duplicates (2)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
    Copyright (C) 2019 D.H.J Polymath

    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"
#include "arb_hypgeom.h"

static void
_platt_lemma_A11_X(arb_t out,
        const arb_t t0, const arb_t h, slong B, const arb_t beta, slong prec)
{
    arb_t x1, x2;

    arb_init(x1);
    arb_init(x2);

    arb_set_si(x1, B);
    arb_mul_2exp_si(x1, x1, -1);
    arb_add(x1, x1, t0, prec);
    arb_pow(x1, x1, beta, prec);

    arb_set_si(x2, B);
    arb_div(x2, x2, h, prec);
    arb_sqr(x2, x2, prec);
    arb_mul_2exp_si(x2, x2, -3);
    arb_neg(x2, x2);
    arb_exp(x2, x2, prec);

    arb_mul(out, x1, x2, prec);

    arb_clear(x1);
    arb_clear(x2);
}

static void
_platt_lemma_A11_Y(arb_t out,
        const arb_t t0, const arb_t h, slong B, const arb_t beta, slong prec)
{
    arb_t x1, x2, x3, x4, x5;

    arb_init(x1);
    arb_init(x2);
    arb_init(x3);
    arb_init(x4);
    arb_init(x5);

    arb_rsqrt_ui(x1, 2, prec);

    arb_pow(x2, t0, beta, prec);

    arb_one(x3);
    arb_mul_2exp_si(x3, x3, -1);

    arb_set_si(x4, B);
    arb_div(x4, x4, h, prec);
    arb_sqr(x4, x4, prec);
    arb_mul_2exp_si(x4, x4, -3);

    arb_hypgeom_gamma_upper(x5, x3, x4, 0, prec);

    arb_mul(out, x1, x2, prec);
    arb_mul(out, out, x5, prec);

    arb_clear(x1);
    arb_clear(x2);
    arb_clear(x3);
    arb_clear(x4);
    arb_clear(x5);
}

static void
_platt_lemma_A11_Z(arb_t out,
        const arb_t t0, const arb_t h, const arb_t beta, slong prec)
{
    arb_t two;
    arb_t x1, x2, x3, x4, x5;

    arb_init(two);
    arb_init(x1);
    arb_init(x2);
    arb_init(x3);
    arb_init(x4);
    arb_init(x5);

    arb_set_ui(two, 2);

    arb_sub_ui(x1, beta, 1, prec);
    arb_mul_2exp_si(x1, x1, -1);
    arb_pow(x1, two, x1, prec);

    arb_pow(x2, h, beta, prec);

    arb_add_ui(x3, beta, 1, prec);
    arb_mul_2exp_si(x3, x3, -1);

    arb_div(x4, t0, h, prec);
    arb_sqr(x4, x4, prec);
    arb_mul_2exp_si(x4, x4, -1);

    arb_hypgeom_gamma_upper(x5, x3, x4, 0, prec);

    arb_mul(out, x1, x2, prec);
    arb_mul(out, out, x5, prec);

    arb_clear(two);
    arb_clear(x1);
    arb_clear(x2);
    arb_clear(x3);
    arb_clear(x4);
    arb_clear(x5);
}

static int
_platt_lemma_A11_constraint(const arb_t t0, const arb_t h, slong B,
        const arb_t beta, slong prec)
{
    int result;

    arb_t a, b, expe;
    arb_init(a);
    arb_init(b);
    arb_init(expe);

    /* expe = exp(e) */
    arb_const_e(expe, prec);
    arb_exp(expe, expe, prec);

    /* a = beta*h^2 / t0 */
    arb_sqr(a, h, prec);
    arb_mul(a, a, beta, prec);
    arb_div(a, a, t0, prec);

    /* b = B/2 */
    arb_set_si(b, B);
    arb_mul_2exp_si(b, b, -1);

    result = arb_le(a, b) && arb_le(b, t0) && arb_gt(t0, expe);

    arb_clear(a);
    arb_clear(b);
    arb_clear(expe);

    return result;
}

void
acb_dirichlet_platt_lemma_A11(arb_t out, const arb_t t0, const arb_t h,
        slong B, slong prec)
{
    arb_t beta;
    arb_init(beta);
    acb_dirichlet_platt_beta(beta, t0, prec);

    if (_platt_lemma_A11_constraint(t0, h, B, beta, prec))
    {
        arb_t X, Y, Z;
        arb_t x1, x2;

        arb_init(X);
        arb_init(Y);
        arb_init(Z);
        arb_init(x1);
        arb_init(x2);

        _platt_lemma_A11_X(X, t0, h, B, beta, prec);
        _platt_lemma_A11_Y(Y, t0, h, B, beta, prec);
        _platt_lemma_A11_Z(Z, t0, h, beta, prec);

        arb_set_ui(x1, 2);
        arb_pow(x1, x1, beta, prec);
        arb_mul(x1, x1, h, prec);
        arb_div_si(x1, x1, B, prec);

        arb_add(x2, Y, Z, prec);
        arb_mul(x2, x2, x1, prec);
        arb_add(x2, x2, X, prec);
        arb_mul_ui(x2, x2, 6, prec);

        arb_set(out, x2);

        arb_clear(X);
        arb_clear(Y);
        arb_clear(Z);
        arb_clear(x1);
        arb_clear(x2);
    }
    else
    {
        arb_zero_pm_inf(out);
    }

    arb_clear(beta);
}