add arb_hurwitz_zeta

This commit is contained in:
Fredrik Johansson 2014-12-29 17:11:03 +01:00
parent 0c850211c9
commit 64ece5fd3d
4 changed files with 153 additions and 2 deletions

1
arb.h
View file

@ -596,6 +596,7 @@ void arb_gamma_fmpz(arb_t z, const fmpz_t x, long prec);
void arb_digamma(arb_t y, const arb_t x, long prec);
void arb_zeta(arb_t z, const arb_t s, long prec);
void arb_zeta_ui(arb_t z, ulong n, long prec);
void arb_hurwitz_zeta(arb_t z, const arb_t s, const arb_t a, long prec);
void arb_bernoulli_ui(arb_t z, ulong n, long prec);
void arb_rising_ui_bs(arb_t y, const arb_t x, ulong n, long prec);

56
arb/hurwitz_zeta.c Normal file
View file

@ -0,0 +1,56 @@
/*=============================================================================
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 "arb.h"
#include "acb.h"
void
arb_hurwitz_zeta(arb_t res, const arb_t s, const arb_t z, long prec)
{
if (!arb_contains_si(s, 1) &&
(arb_is_positive(z) ||
(arb_is_int(z) && arb_is_int(s) && arb_is_nonpositive(s))))
{
acb_t a, b, c;
acb_init(a);
acb_init(b);
acb_init(c);
acb_set_arb(a, s);
acb_set_arb(b, z);
acb_hurwitz_zeta(c, a, b, prec);
arb_set(res, acb_realref(c));
acb_clear(a);
acb_clear(b);
acb_clear(c);
}
else
{
arb_indeterminate(res);
}
}

89
arb/test/t-hurwitz_zeta.c Normal file
View file

@ -0,0 +1,89 @@
/*=============================================================================
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) 2012, 2013 Fredrik Johansson
******************************************************************************/
#include "arb.h"
#include "acb.h"
int main()
{
long iter;
flint_rand_t state;
printf("hurwitz_zeta....");
fflush(stdout);
flint_randinit(state);
for (iter = 0; iter < 1000; iter++)
{
arb_t a, b, c;
acb_t d, e, f;
long prec;
prec = 2 + n_randint(state, 300);
arb_init(a);
arb_init(b);
arb_init(c);
acb_init(d);
acb_init(e);
acb_init(f);
arb_randtest_precise(a, state, 1 + n_randint(state, 300), 5);
arb_randtest_precise(b, state, 1 + n_randint(state, 300), 5);
arb_randtest_precise(c, state, 1 + n_randint(state, 300), 5);
acb_set_arb(d, a);
acb_set_arb(e, b);
arb_hurwitz_zeta(c, a, b, prec);
acb_hurwitz_zeta(f, d, e, prec);
if (!arb_overlaps(c, acb_realref(f)) ||
(arb_is_finite(c) && !arb_contains_zero(acb_imagref(f))))
{
printf("FAIL: overlap\n\n");
printf("a = "); arb_printd(a, 15); printf("\n\n");
printf("b = "); arb_printd(b, 15); printf("\n\n");
printf("c = "); arb_printd(c, 15); printf("\n\n");
printf("d = "); acb_printd(d, 15); printf("\n\n");
printf("e = "); acb_printd(e, 15); printf("\n\n");
printf("f = "); acb_printd(f, 15); printf("\n\n");
abort();
}
arb_clear(a);
arb_clear(b);
arb_clear(c);
acb_clear(d);
acb_clear(e);
acb_clear(f);
}
flint_randclear(state);
flint_cleanup();
printf("PASS\n");
return EXIT_SUCCESS;
}

View file

@ -956,8 +956,13 @@ Zeta function
Sets *z* to the value of the Riemann zeta function `\zeta(s)`.
Note: the Hurwitz zeta function is also available, but takes
complex arguments (see :func:`acb_hurwitz_zeta`).
For computing derivatives with respect to `s`,
use :func:`arb_poly_zeta_series`.
.. function:: void arb_hurwitz_zeta(arb_t z, const arb_t s, const arb_t a, long prec)
Sets *z* to the value of the Hurwitz zeta function `\zeta(s,a)`.
For computing derivatives with respect to `s`,
use :func:`arb_poly_zeta_series`.