% CAAM 453 Homework 6, #3 -- GK15.m % % Compute nodes and weights for the Gauss-Kronrod (7,15) pair on the % interval [a,b]. % % Inputs: % a,b: endpoints of the interval % % Outputs: % x: length-15 vector of nodes % wKron: length-15 vector of Gauss-Kronrod weights % wGauss: length-15 vector of Gauss weights % (nonzero only on the original 7 Gauss nodes). % function [x,wKron,wGauss] = GK15(a,b) % Nodes and weights for Gauss-Kronrod (7,15) pair on the interval [-1,1]. % % Data courtesy of QUADPACK's qk15.f, available from: % http://www.netlib.org/quadpack/qk15.f % x01 = [-0.9914553711208126; -0.9491079123427585; -0.8648644233597691; -0.7415311855993944; -0.5860872354676911; -0.4058451513773972; -0.2077849550078985; 0.0 0.2077849550078985; 0.4058451513773972; 0.5860872354676911; 0.7415311855993944; 0.8648644233597691; 0.9491079123427585; 0.9914553711208126]; wKron01 = [0.02293532201052922; 0.06309209262997855; 0.1047900103222502; 0.1406532597155259; 0.1690047266392679; 0.1903505780647854; 0.2044329400752989; 0.2094821410847278 0.2044329400752989; 0.1903505780647854; 0.1690047266392679; 0.1406532597155259; 0.1047900103222502; 0.06309209262997855; 0.02293532201052922]; wGauss01 = [0; 0.1294849661688697; 0; 0.2797053914892767; 0; 0.3818300505051189; 0; 0.4179591836734694 0; 0.3818300505051189; 0; 0.2797053914892767; 0; 0.1294849661688697; 0]; % Adapt the nodes and weights from [-1,1] to [a,b]: stretch = 0.5 * (b-a); x = 0.5 * (b+a) + stretch * x01; wKron = wKron01 * stretch; wGauss = wGauss01 * stretch; end