mirror of
https://github.com/vale981/arb
synced 2025-03-06 01:41:39 -05:00
slightly improve const_glaisher
This commit is contained in:
parent
6e8e2d26ad
commit
9ddd9641eb
1 changed files with 20 additions and 29 deletions
|
@ -24,46 +24,37 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "fmprb.h"
|
#include "fmprb.h"
|
||||||
#include "fmprb_poly.h"
|
#include "zeta.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
fmprb_const_glaisher_eval(fmprb_t y, long prec)
|
fmprb_const_glaisher_eval(fmprb_t y, long prec)
|
||||||
{
|
{
|
||||||
fmprb_t t;
|
fmpcb_struct z[2];
|
||||||
fmprb_struct z[2];
|
fmpcb_t s, a;
|
||||||
long wp;
|
long wp;
|
||||||
|
|
||||||
fmprb_init(t);
|
fmpcb_init(z + 0);
|
||||||
fmprb_init(z + 0);
|
fmpcb_init(z + 1);
|
||||||
fmprb_init(z + 1);
|
fmpcb_init(s);
|
||||||
|
fmpcb_init(a);
|
||||||
|
|
||||||
wp = prec + 20;
|
wp = prec + 20;
|
||||||
|
|
||||||
fmprb_set_ui(z + 0, 2);
|
/* directly evaluating at s = -1 is slightly faster
|
||||||
fmprb_one(z + 1);
|
than evaluating at s = 2 */
|
||||||
fmprb_one(t);
|
fmpcb_set_si(s, -1);
|
||||||
|
fmpcb_one(a);
|
||||||
|
zeta_series(z, s, a, 0, 2, wp);
|
||||||
|
|
||||||
_fmprb_poly_zeta_series(z, z, 2, t, 0, 2, wp);
|
fmprb_one(y);
|
||||||
|
fmprb_div_ui(y, y, 12, wp);
|
||||||
|
fmprb_sub(y, y, fmpcb_realref(z + 1), wp);
|
||||||
|
fmprb_exp(y, y, wp);
|
||||||
|
|
||||||
fmprb_const_pi(z, wp);
|
fmpcb_clear(z + 0);
|
||||||
fmprb_mul(z, z, z, wp);
|
fmpcb_clear(z + 1);
|
||||||
fmprb_mul_2exp_si(z, z, 1);
|
fmpcb_clear(s);
|
||||||
fmprb_div(z, z + 1, z, wp);
|
fmpcb_clear(a);
|
||||||
|
|
||||||
fmprb_const_euler(t, wp);
|
|
||||||
fmprb_div_ui(t, t, 12, wp);
|
|
||||||
fmprb_sub(t, t, z, wp);
|
|
||||||
fmprb_exp(y, t, wp);
|
|
||||||
|
|
||||||
fmprb_const_pi(t, wp);
|
|
||||||
fmprb_mul_2exp_si(t, t, 1);
|
|
||||||
fmprb_root(t, t, 12, wp);
|
|
||||||
|
|
||||||
fmprb_mul(y, y, t, prec);
|
|
||||||
|
|
||||||
fmprb_clear(t);
|
|
||||||
fmprb_clear(z + 0);
|
|
||||||
fmprb_clear(z + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_CACHED_CONSTANT(fmprb_const_glaisher, fmprb_const_glaisher_eval)
|
DEF_CACHED_CONSTANT(fmprb_const_glaisher, fmprb_const_glaisher_eval)
|
||||||
|
|
Loading…
Add table
Reference in a new issue