//Evan Warner //This class stores an instance of a Gauss-Jacobi quadrature routine for a given alpha, beta, a, and b //The format of the calculated integral is fint(f(x)*(x-a)^alpha*(x-b)^beta,x,a,b) public class GaussQuad { private static ComplexFunction f; private static double alpha, beta; private static Complex a, b; public GaussQuad(ComplexFunction f1, double alpha1, double beta1, Complex a1, Complex b1) { f=f1; alpha=alpha1; beta=beta1; a=a1; b=b1; } //Accepts points/weights in range [-1,1]; tranforms to other values using formula //fint((x-a)^alpha*(x-b)^beta*f(x),x,a,b)=-c^(alpha+beta+1)*fint((1-x)^alpha*(1+x)^beta*f(c*x+m),x,-1,1) //where m=(a+b)/2 and c=b-m=m-a. public Complex integrate(int N) { GaussJacobiWeights gjw = new GaussJacobiWeights(alpha,beta,N); double[] points = gjw.getPoints(); double[] weights = gjw.getWeights(); Complex m= b.add(a).divide(2); Complex c= b.subtract(m); Complex sum = new Complex(0,0); for(int i=0;i