From ca11ad10d7d66d30e7e1a48e55d70eb3942b035d Mon Sep 17 00:00:00 2001
From: Andreas Freise <adf@star.bham.ac.uk>
Date: Sat, 14 May 2016 16:44:36 +0100
Subject: [PATCH] adding jacobi.py

---
 pykat/math/jacobi.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 pykat/math/jacobi.py

diff --git a/pykat/math/jacobi.py b/pykat/math/jacobi.py
new file mode 100644
index 0000000..2ff8fd8
--- /dev/null
+++ b/pykat/math/jacobi.py
@@ -0,0 +1,17 @@
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import numpy as np
+import scipy.special
+
+def jacobi(n,a,b,x):
+  """ Implementation of Jacobi fucntion using binominal coefficients.
+  This can handle values of alpha, beta < -1 which the special.eval_jacobi
+  function cannot."""
+  P=0.0
+  for s in np.arange(0,n+1):
+    P=P+scipy.special.binom(n+a,s) * scipy.special.binom(n+b,n-s) * (x-1.0)**(n-s) * (x+1.0)**s
+  P=P*0.5**n
+  return P
-- 
GitLab