예제 #1
0
void
arb_hypgeom_chebyshev_t(arb_t res, const arb_t nu, const arb_t z, slong prec)
{
    acb_t t, u;
    acb_init(t);
    acb_init(u);
    arb_set(acb_realref(t), nu);
    arb_set(acb_realref(u), z);
    acb_hypgeom_chebyshev_t(t, t, u, prec);
    if (acb_is_finite(t) && acb_is_real(t))
        arb_swap(res, acb_realref(t));
    else
        arb_indeterminate(res);
    acb_clear(t);
    acb_clear(u);
}
예제 #2
0
int main()
{
    long iter;
    flint_rand_t state;

    printf("chebyshev_t....");
    fflush(stdout);

    flint_randinit(state);

    for (iter = 0; iter < 2000; iter++)
    {
        acb_t n, z, a, b, c, t, res1, res2;
        long prec;

        acb_init(n);
        acb_init(z);
        acb_init(a);
        acb_init(b);
        acb_init(c);
        acb_init(t);
        acb_init(res1);
        acb_init(res2);

        prec = 2 + n_randint(state, 300);

        acb_randtest_param(n, state, 1 + n_randint(state, 400), 1 + n_randint(state, 10));
        acb_randtest_param(z, state, 1 + n_randint(state, 400), 1 + n_randint(state, 10));
        acb_randtest_param(res1, state, 1 + n_randint(state, 400), 1 + n_randint(state, 10));
        acb_randtest_param(res2, state, 1 + n_randint(state, 400), 1 + n_randint(state, 10));

        acb_hypgeom_chebyshev_t(res1, n, z, prec);

        acb_neg(a, n);
        acb_set(b, n);
        acb_one(c);
        acb_mul_2exp_si(c, c, -1);
        acb_sub_ui(t, z, 1, prec);
        acb_neg(t, t);
        acb_mul_2exp_si(t, t, -1);
        acb_hypgeom_2f1(res2, a, b, c, t, 0, 2 + n_randint(state, 300));

        if (!acb_overlaps(res1, res2))
        {
            printf("FAIL: consistency\n\n");
            printf("iter = %ld\n\n", iter);
            printf("n = ");
            acb_printd(n, 30);
            printf("\n\n");
            printf("z = ");
            acb_printd(z, 30);
            printf("\n\n");
            printf("res1 = ");
            acb_printd(res1, 30);
            printf("\n\n");
            printf("res2 = ");
            acb_printd(res2, 30);
            printf("\n\n");
            abort();
        }

        acb_clear(n);
        acb_clear(z);
        acb_clear(a);
        acb_clear(b);
        acb_clear(c);
        acb_clear(t);
        acb_clear(res1);
        acb_clear(res2);
    }

    flint_randclear(state);
    flint_cleanup();
    printf("PASS\n");
    return EXIT_SUCCESS;
}