From b81c9fc23908eff3f92bc5cb9cb1485ca6a9d4b2 Mon Sep 17 00:00:00 2001 From: Aadi B <122440845+aadi-bh@users.noreply.github.com> Date: Sat, 25 Nov 2023 00:51:36 +0530 Subject: [PATCH] Add `ggb.py` --- ggb.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ggb.py diff --git a/ggb.py b/ggb.py new file mode 100644 index 0000000..d2ed109 --- /dev/null +++ b/ggb.py @@ -0,0 +1,37 @@ +# Gegenbauer polynomials -- the Gibbs complimentary basis to Fourier + +import numpy as np +from scipy.special import gegenbauer as ggb +from scipy.special import gamma, factorial + +''' +Maps interval [a,b] to [-1,1] +''' +def z(y, a, b): + return -1 + 2 * (y-a)/(b-a) + +''' +Weight function +''' +def w(x, lam): + return np.power(1-np.power(x,2), lam-0.5) + +''' +Ggb polynomial of order n evaluated at x +''' +def C(x, n, lam): + return ggb(n, lam)(x) + +''' +Square of weighted norm of C(n, lam) +''' +def gam(n, lam): + r = np.sqrt(np.pi) + r *= gamma(n + 2*lam) * gamma(lam + 0.5) + r /= gamma(lam) * gamma(2 * lam) * factorial(n) * (n+lam) + return r + +# TODO +# Need a way to compute the inner product on an arbitrary interval +# Expand it in terms of the ggbs +# Patch it back into the solution.