20 @brief This script computes Gauss-Jacobi quadrature roots and weights using
24 The script takes polynomial degree, alpha, beta, and method parameters to
25 compute Gauss-Jacobi quadrature roots and weights. It calls the GaussJacobiQuad
26 library for the calculations.
36 def main(n, alpha, beta, meth):
38 roots, weights = gjquadpy.gaussjacobiquadccompat.gauss_jacobi_rec_c(
42 roots, weights = gjquadpy.gaussjacobiquadccompat.gauss_jacobi_gw_c(
45 elif meth ==
"algo665":
46 roots, weights = gjquadpy.gaussjacobiquadccompat.gauss_jacobi_algo665_c(
50 for idx, root
in enumerate(roots):
51 sign =
" " if root >= 0
else ""
52 root_str = f
"{root:23.17E}"
53 weight_str = f
"{weights[idx]:23.17E}"
54 print(f
"Root:{sign} {root_str} Weight: {weight_str}")
57 if __name__ ==
"__main__":
58 parser = argparse.ArgumentParser(
59 description=
"Compute Gauss-Jacobi quadrature via GaussJacobiQuad."
61 parser.add_argument(
"--npts", type=int, default=5, help=
"Degree of the polynomial.")
62 parser.add_argument(
"--alpha", type=float, default=0, help=
"Alpha parameter.")
63 parser.add_argument(
"--beta", type=float, default=12, help=
"Beta parameter.")
69 choices=[
"gw",
"rec",
"algo665"],
72 args = parser.parse_args()
74 main(args.npts, args.alpha, args.beta, args.meth)
def main(n, alpha, beta, meth)