Skip to content

Commit

Permalink
code for 2F1 in the exp(pi i/3) corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Oct 18, 2015
1 parent f710012 commit 1a2b993
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 3 deletions.
2 changes: 2 additions & 0 deletions acb_hypgeom.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void acb_hypgeom_2f1_direct(acb_t res, const acb_t a, const acb_t b, const acb_t
void acb_hypgeom_2f1_pfaff(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec);
void acb_hypgeom_2f1_inf(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec);
void acb_hypgeom_2f1_inf_limit(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec);
void acb_hypgeom_2f1_corner(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec);

void acb_hypgeom_2f1(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, long prec);

#ifdef __cplusplus
Expand Down
67 changes: 67 additions & 0 deletions acb_hypgeom/2f1_corner.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*=============================================================================
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) 2015 Fredrik Johansson
******************************************************************************/

#include "acb_hypgeom.h"

void
acb_hypgeom_2f1_corner(acb_t res, const acb_t a, const acb_t b,
const acb_t c, const acb_t z, int regularized, long prec)
{
acb_t aa, bb, cc, z1, z2, f1, f2;
int upper;

acb_init(aa); acb_init(bb); acb_init(cc);
acb_init(z1); acb_init(z2); acb_init(f1); acb_init(f2);

acb_add_ui(aa, a, 1, prec);
acb_add_ui(bb, b, 1, prec);
acb_add_ui(cc, c, 1, prec);

upper = arb_is_positive(acb_imagref(z));

/* 0 -> 0.5 +/- 0.5i -> 0.5 +/- 0.75i -> z */
acb_set_d_d(z1, 0.5, upper ? 0.5 : -0.5);
acb_set_d_d(z2, 0.5, upper ? 0.75 : -0.75);

acb_hypgeom_2f1(f1, a, b, c, z1, regularized, prec);
acb_hypgeom_2f1(f2, aa, bb, cc, z1, regularized, prec);
acb_mul(f2, f2, a, prec);
acb_mul(f2, f2, b, prec);
if (!regularized)
acb_div(f2, f2, c, prec);

acb_hypgeom_2f1_continuation(f1, f2, a, b, c, z1, z2, f1, f2, prec);

acb_set(z1, z2);
acb_set(z2, z);

acb_hypgeom_2f1_continuation(f1, f2, a, b, c, z1, z2, f1, f2, prec);

acb_set(res, f1);

acb_clear(aa); acb_clear(bb); acb_clear(cc);
acb_clear(z1); acb_clear(z2); acb_clear(f1); acb_clear(f2);
}

9 changes: 6 additions & 3 deletions acb_hypgeom/test/t-2f1.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ int main()
reg1 = n_randint(state, 2);
reg2 = n_randint(state, 2);

alg1 = n_randint(state, 4);
alg2 = n_randint(state, 4);
alg1 = n_randint(state, 5);
alg2 = n_randint(state, 5);

switch (alg1)
{
Expand All @@ -82,6 +82,9 @@ int main()
case 2:
acb_hypgeom_2f1_inf(w1, a, b, c, z, reg1, prec1);
break;
case 3:
acb_hypgeom_2f1_corner(w1, a, b, c, z, reg1, prec1);
break;
default:
acb_hypgeom_2f1(w1, a, b, c, z, reg1, prec1);
}
Expand All @@ -97,7 +100,7 @@ int main()
case 2:
acb_hypgeom_2f1_inf(w2, a, b, c, z, reg2, prec2);
break;
default:
default: /* favor this */
acb_hypgeom_2f1(w2, a, b, c, z, reg2, prec2);
}

Expand Down

0 comments on commit 1a2b993

Please sign in to comment.