more functions wrapped for arb_hypgeom

This commit is contained in:
Fredrik Johansson 2016-07-06 20:05:09 +02:00
parent 6316497cf5
commit 0524b0dfec
8 changed files with 585 additions and 0 deletions

View file

@ -35,6 +35,30 @@ void arb_hypgeom_fresnel(arb_t res1, arb_t res2, const arb_t z, int normalized,
void _arb_hypgeom_fresnel_series(arb_ptr s, arb_ptr c, arb_srcptr h, slong hlen, int normalized, slong len, slong prec); void _arb_hypgeom_fresnel_series(arb_ptr s, arb_ptr c, arb_srcptr h, slong hlen, int normalized, slong len, slong prec);
void arb_hypgeom_fresnel_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, int normalized, slong len, slong prec); void arb_hypgeom_fresnel_series(arb_poly_t s, arb_poly_t c, const arb_poly_t h, int normalized, slong len, slong prec);
void arb_hypgeom_ei(arb_t res, const arb_t z, slong prec);
void _arb_hypgeom_ei_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec);
void arb_hypgeom_ei_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec);
void arb_hypgeom_si(arb_t res, const arb_t z, slong prec);
void _arb_hypgeom_si_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec);
void arb_hypgeom_si_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec);
void arb_hypgeom_ci(arb_t res, const arb_t z, slong prec);
void _arb_hypgeom_ci_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec);
void arb_hypgeom_ci_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec);
void arb_hypgeom_shi(arb_t res, const arb_t z, slong prec);
void _arb_hypgeom_shi_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec);
void arb_hypgeom_shi_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec);
void arb_hypgeom_chi(arb_t res, const arb_t z, slong prec);
void _arb_hypgeom_chi_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec);
void arb_hypgeom_chi_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec);
void arb_hypgeom_li(arb_t res, const arb_t z, int offset, slong prec);
void _arb_hypgeom_li_series(arb_ptr g, arb_srcptr h, slong hlen, int offset, slong len, slong prec);
void arb_hypgeom_li_series(arb_poly_t g, const arb_poly_t h, int offset, slong len, slong prec);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

80
arb_hypgeom/chi_series.c Normal file
View file

@ -0,0 +1,80 @@
/*
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 "arb_hypgeom.h"
void
_arb_hypgeom_chi_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec)
{
arb_t c;
if (!arb_is_positive(h))
{
_arb_vec_indeterminate(g, len);
return;
}
arb_init(c);
arb_hypgeom_chi(c, h, prec);
hlen = FLINT_MIN(hlen, len);
if (hlen == 1)
{
_arb_vec_zero(g + 1, len - 1);
}
else
{
arb_ptr t, u, v;
t = _arb_vec_init(len);
u = _arb_vec_init(len);
v = _arb_vec_init(len);
/* Chi(h(x)) = integral([h'(x) / h(x)] cosh(h(x)) */
_arb_poly_cosh_series(t, h, hlen, len - 1, prec);
_arb_poly_derivative(u, h, hlen, prec);
_arb_poly_mullow(v, t, len - 1, u, len - 1, len - 1, prec);
_arb_poly_div_series(u, v, len - 1, h, hlen, len - 1, prec);
_arb_poly_integral(g, u, len, prec);
_arb_vec_clear(t, len);
_arb_vec_clear(u, len);
_arb_vec_clear(v, len);
}
arb_swap(g, c);
arb_clear(c);
}
void
arb_hypgeom_chi_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec)
{
slong hlen = h->length;
if (len == 0)
{
arb_poly_zero(g);
return;
}
if (hlen == 0)
{
arb_poly_inv_series(g, h, len, prec);
return;
}
arb_poly_fit_length(g, len);
_arb_hypgeom_chi_series(g->coeffs, h->coeffs, hlen, len, prec);
_arb_poly_set_length(g, len);
_arb_poly_normalise(g);
}

80
arb_hypgeom/ci_series.c Normal file
View file

@ -0,0 +1,80 @@
/*
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 "arb_hypgeom.h"
void
_arb_hypgeom_ci_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec)
{
arb_t c;
if (!arb_is_positive(h))
{
_arb_vec_indeterminate(g, len);
return;
}
arb_init(c);
arb_hypgeom_ci(c, h, prec);
hlen = FLINT_MIN(hlen, len);
if (hlen == 1)
{
_arb_vec_zero(g + 1, len - 1);
}
else
{
arb_ptr t, u, v;
t = _arb_vec_init(len);
u = _arb_vec_init(len);
v = _arb_vec_init(len);
/* Ci(h(x)) = integral([h'(x) / h(x)] cos(h(x)) */
_arb_poly_cos_series(t, h, hlen, len - 1, prec);
_arb_poly_derivative(u, h, hlen, prec);
_arb_poly_mullow(v, t, len - 1, u, len - 1, len - 1, prec);
_arb_poly_div_series(u, v, len - 1, h, hlen, len - 1, prec);
_arb_poly_integral(g, u, len, prec);
_arb_vec_clear(t, len);
_arb_vec_clear(u, len);
_arb_vec_clear(v, len);
}
arb_swap(g, c);
arb_clear(c);
}
void
arb_hypgeom_ci_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec)
{
slong hlen = h->length;
if (len == 0)
{
arb_poly_zero(g);
return;
}
if (hlen == 0)
{
arb_poly_inv_series(g, h, len, prec);
return;
}
arb_poly_fit_length(g, len);
_arb_hypgeom_ci_series(g->coeffs, h->coeffs, hlen, len, prec);
_arb_poly_set_length(g, len);
_arb_poly_normalise(g);
}

80
arb_hypgeom/ei_series.c Normal file
View file

@ -0,0 +1,80 @@
/*
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 "arb_hypgeom.h"
void
_arb_hypgeom_ei_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec)
{
arb_t c;
if (arb_contains_zero(h))
{
_arb_vec_indeterminate(g, len);
return;
}
arb_init(c);
arb_hypgeom_ei(c, h, prec);
hlen = FLINT_MIN(hlen, len);
if (hlen == 1)
{
_arb_vec_zero(g + 1, len - 1);
}
else
{
arb_ptr t, u, v;
t = _arb_vec_init(len);
u = _arb_vec_init(len);
v = _arb_vec_init(len);
/* Ei(h(x)) = integral([h'(x) / h(x)] exp(h(x)) */
_arb_poly_exp_series(t, h, hlen, len - 1, prec);
_arb_poly_derivative(u, h, hlen, prec);
_arb_poly_mullow(v, t, len - 1, u, len - 1, len - 1, prec);
_arb_poly_div_series(u, v, len - 1, h, hlen, len - 1, prec);
_arb_poly_integral(g, u, len, prec);
_arb_vec_clear(t, len);
_arb_vec_clear(u, len);
_arb_vec_clear(v, len);
}
arb_swap(g, c);
arb_clear(c);
}
void
arb_hypgeom_ei_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec)
{
slong hlen = h->length;
if (len == 0)
{
arb_poly_zero(g);
return;
}
if (hlen == 0)
{
arb_poly_inv_series(g, h, len, prec);
return;
}
arb_poly_fit_length(g, len);
_arb_hypgeom_ei_series(g->coeffs, h->coeffs, hlen, len, prec);
_arb_poly_set_length(g, len);
_arb_poly_normalise(g);
}

82
arb_hypgeom/li_series.c Normal file
View file

@ -0,0 +1,82 @@
/*
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 "arb_hypgeom.h"
void
_arb_hypgeom_li_series(arb_ptr g, arb_srcptr h, slong hlen, int offset, slong len, slong prec)
{
arb_t c;
if (!arb_is_positive(h) || arb_contains_si(h, 1))
{
_arb_vec_indeterminate(g, len);
return;
}
arb_init(c);
arb_hypgeom_li(c, h, offset, prec);
hlen = FLINT_MIN(hlen, len);
if (hlen == 1)
{
_arb_vec_zero(g + 1, len - 1);
}
else if (len == 2)
{
arb_log(g, h, prec);
arb_div(g + 1, h + 1, g, prec);
}
else
{
arb_ptr t, u;
t = _arb_vec_init(len);
u = _arb_vec_init(hlen);
/* li(h(x)) = integral(h'(x) / log(h(x))) */
_arb_poly_log_series(t, h, hlen, len - 1, prec);
_arb_poly_derivative(u, h, hlen, prec);
_arb_poly_div_series(g, u, hlen - 1, t, len - 1, len - 1, prec);
_arb_poly_integral(g, g, len, prec);
_arb_vec_clear(t, len);
_arb_vec_clear(u, hlen);
}
arb_swap(g, c);
arb_clear(c);
}
void
arb_hypgeom_li_series(arb_poly_t g, const arb_poly_t h, int offset, slong len, slong prec)
{
slong hlen = h->length;
if (len == 0)
{
arb_poly_zero(g);
return;
}
if (hlen == 0)
{
arb_poly_inv_series(g, h, len, prec);
return;
}
arb_poly_fit_length(g, len);
_arb_hypgeom_li_series(g->coeffs, h->coeffs, hlen, offset, len, prec);
_arb_poly_set_length(g, len);
_arb_poly_normalise(g);
}

61
arb_hypgeom/shi_series.c Normal file
View file

@ -0,0 +1,61 @@
/*
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 "arb_hypgeom.h"
#include "acb_hypgeom.h"
/* todo: use a sinch function? */
void
_arb_hypgeom_shi_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec)
{
hlen = FLINT_MIN(hlen, len);
if (hlen == 1)
{
arb_hypgeom_shi(g, h, prec);
_arb_vec_zero(g + 1, len - 1);
}
else
{
acb_ptr t;
slong i;
t = _acb_vec_init(len);
for (i = 0; i < hlen; i++)
arb_set(acb_realref(t + i), h + i);
_acb_hypgeom_shi_series(t, t, hlen, len, prec);
for (i = 0; i < len; i++)
arb_swap(g + i, acb_realref(t + i));
_acb_vec_clear(t, len);
}
}
void
arb_hypgeom_shi_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec)
{
slong hlen = h->length;
if (hlen == 0 || len == 0)
{
arb_poly_zero(g);
return;
}
arb_poly_fit_length(g, len);
_arb_hypgeom_shi_series(g->coeffs, h->coeffs, hlen, len, prec);
_arb_poly_set_length(g, len);
_arb_poly_normalise(g);
}

70
arb_hypgeom/si_series.c Normal file
View file

@ -0,0 +1,70 @@
/*
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 "arb_hypgeom.h"
void
_arb_hypgeom_si_series(arb_ptr g, arb_srcptr h, slong hlen, slong len, slong prec)
{
arb_t c;
arb_init(c);
arb_hypgeom_si(c, h, prec);
hlen = FLINT_MIN(hlen, len);
if (hlen == 1)
{
_arb_vec_zero(g + 1, len - 1);
}
else if (len == 2)
{
arb_sinc(g, h, prec);
arb_mul(g + 1, g, h + 1, prec);
}
else
{
arb_ptr t, u;
t = _arb_vec_init(len - 1);
u = _arb_vec_init(hlen - 1);
/* Si(h(x)) = integral(h'(x) sinc(h(x))) */
_arb_poly_sinc_series(t, h, hlen, len - 1, prec);
_arb_poly_derivative(u, h, hlen, prec);
_arb_poly_mullow(g, t, len - 1, u, hlen - 1, len - 1, prec);
_arb_poly_integral(g, g, len, prec);
_arb_vec_clear(t, len - 1);
_arb_vec_clear(u, hlen - 1);
}
arb_swap(g, c);
arb_clear(c);
}
void
arb_hypgeom_si_series(arb_poly_t g, const arb_poly_t h, slong len, slong prec)
{
slong hlen = h->length;
if (hlen == 0 || len == 0)
{
arb_poly_zero(g);
return;
}
arb_poly_fit_length(g, len);
_arb_hypgeom_si_series(g->coeffs, h->coeffs, hlen, len, prec);
_arb_poly_set_length(g, len);
_arb_poly_normalise(g);
}

View file

@ -88,3 +88,111 @@ arb_hypgeom_fresnel(arb_t res1, arb_t res2, const arb_t z, int normalized, slong
} }
} }
void
arb_hypgeom_ei(arb_t res, const arb_t z, slong prec)
{
if (!arb_is_finite(z))
{
arb_indeterminate(res);
}
else
{
acb_t t;
acb_init(t);
arb_set(acb_realref(t), z);
acb_hypgeom_ei(t, t, prec);
arb_swap(res, acb_realref(t));
acb_clear(t);
}
}
void
arb_hypgeom_si(arb_t res, const arb_t z, slong prec)
{
if (!arb_is_finite(z))
{
arb_indeterminate(res);
}
else
{
acb_t t;
acb_init(t);
arb_set(acb_realref(t), z);
acb_hypgeom_si(t, t, prec);
arb_swap(res, acb_realref(t));
acb_clear(t);
}
}
void
arb_hypgeom_ci(arb_t res, const arb_t z, slong prec)
{
if (!arb_is_finite(z) || !arb_is_positive(z))
{
arb_indeterminate(res);
}
else
{
acb_t t;
acb_init(t);
arb_set(acb_realref(t), z);
acb_hypgeom_ci(t, t, prec);
arb_swap(res, acb_realref(t));
acb_clear(t);
}
}
void
arb_hypgeom_shi(arb_t res, const arb_t z, slong prec)
{
if (!arb_is_finite(z))
{
arb_indeterminate(res);
}
else
{
acb_t t;
acb_init(t);
arb_set(acb_realref(t), z);
acb_hypgeom_shi(t, t, prec);
arb_swap(res, acb_realref(t));
acb_clear(t);
}
}
void
arb_hypgeom_chi(arb_t res, const arb_t z, slong prec)
{
if (!arb_is_finite(z) || !arb_is_positive(z))
{
arb_indeterminate(res);
}
else
{
acb_t t;
acb_init(t);
arb_set(acb_realref(t), z);
acb_hypgeom_chi(t, t, prec);
arb_swap(res, acb_realref(t));
acb_clear(t);
}
}
void
arb_hypgeom_li(arb_t res, const arb_t z, int offset, slong prec)
{
if (!arb_is_finite(z) || !arb_is_nonnegative(z))
{
arb_indeterminate(res);
}
else
{
acb_t t;
acb_init(t);
arb_set(acb_realref(t), z);
acb_hypgeom_li(t, t, offset, prec);
arb_swap(res, acb_realref(t));
acb_clear(t);
}
}