2013-04-26 18:20:47 +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 General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
ARB is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with ARB; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
=============================================================================*/
|
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
Copyright (C) 2013 Fredrik Johansson
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include "partitions.h"
|
|
|
|
|
|
|
|
static void
|
2014-06-17 16:25:54 +02:00
|
|
|
_arf_sinh(arf_t y, const arf_t x, long prec)
|
2013-04-26 18:20:47 +02:00
|
|
|
{
|
2014-06-17 16:25:54 +02:00
|
|
|
arb_t t;
|
|
|
|
arb_init(t);
|
|
|
|
arb_set_arf(t, x);
|
|
|
|
arb_sinh(t, t, prec);
|
|
|
|
arb_get_abs_ubound_arf(y, t, prec);
|
|
|
|
arb_clear(t);
|
2013-04-26 18:20:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Equation (1.8) in the paper */
|
|
|
|
void
|
2014-06-17 16:25:54 +02:00
|
|
|
partitions_rademacher_bound(arf_t b, const fmpz_t n, ulong N)
|
2013-04-26 18:20:47 +02:00
|
|
|
{
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_t A, B, C, t, u;
|
2014-03-03 16:32:29 +01:00
|
|
|
fmpz_t n1;
|
2013-04-26 18:20:47 +02:00
|
|
|
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_init(A);
|
|
|
|
arf_init(B);
|
|
|
|
arf_init(C);
|
|
|
|
arf_init(t);
|
|
|
|
arf_init(u);
|
2014-03-03 16:32:29 +01:00
|
|
|
fmpz_init(n1);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* bound for 44*pi^2/(225*sqrt(3)) */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_set_si_2exp_si(A, 18695160, -24);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* bound for pi*sqrt(2)/75 */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_set_si_2exp_si(B, 993857, -24);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* bound for pi*sqrt(2/3) */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_set_si_2exp_si(C, 43035232, -24);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* first term: A / sqrt(N) */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_sqrt_ui(t, N, MAG_BITS, ARF_RND_DOWN);
|
|
|
|
arf_div(b, A, t, MAG_BITS, ARF_RND_UP);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* B * sqrt(N/(n-1)) */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_set_ui(t, N);
|
2014-03-03 16:32:29 +01:00
|
|
|
fmpz_sub_ui(n1, n, 1);
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_div_fmpz(t, t, n1, MAG_BITS, ARF_RND_UP);
|
|
|
|
arf_sqrt(t, t, MAG_BITS, ARF_RND_UP);
|
|
|
|
arf_mul(t, B, t, MAG_BITS, ARF_RND_UP);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* sinh(C*sqrt(n)/N) */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_sqrt_fmpz(u, n, MAG_BITS, ARF_RND_UP);
|
|
|
|
arf_div_ui(u, u, N, MAG_BITS, ARF_RND_UP);
|
|
|
|
arf_mul(u, C, u, MAG_BITS, ARF_RND_UP);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
2014-06-17 16:25:54 +02:00
|
|
|
_arf_sinh(u, u, MAG_BITS);
|
2013-04-26 18:20:47 +02:00
|
|
|
|
|
|
|
/* second term: B * ... * sinh... */
|
2014-06-17 16:25:54 +02:00
|
|
|
arf_mul(t, t, u, MAG_BITS, ARF_RND_UP);
|
|
|
|
arf_add(b, b, t, MAG_BITS, ARF_RND_UP);
|
|
|
|
|
|
|
|
arf_clear(A);
|
|
|
|
arf_clear(B);
|
|
|
|
arf_clear(C);
|
|
|
|
arf_clear(t);
|
|
|
|
arf_clear(u);
|
2014-03-03 16:32:29 +01:00
|
|
|
fmpz_clear(n1);
|
2013-04-26 18:20:47 +02:00
|
|
|
}
|
|
|
|
|