(out) user-allocated quadrature nodes in ascending order length of N
(out) user-allocated corresponding quadrature weights length of N
(temp) user-allocated workspace length of greate or equal to N ^^ 2
(optional) parameter '> -1'
(optional) parameter '> -1'
0 on success, xSTEQR LAPACK code on numerical error.
import mir.math.common; auto n = 7; auto x = new double[n]; auto w = new double[n]; auto work = new double[n ^^ 2]; gaussLobattoQuadrature(x, w, work); static immutable xc = [-1, -sqrt(5.0 / 11 + 2.0 / 11 * sqrt(5.0 / 3)), -sqrt(5.0 / 11 - 2.0 / 11 * sqrt(5.0 / 3)), 0. , +sqrt(5.0 / 11 - 2.0 / 11 * sqrt(5.0 / 3)), +sqrt(5.0 / 11 + 2.0 / 11 * sqrt(5.0 / 3)), 1]; static immutable wc = [1.0 / 21, (124.0 - 7 * sqrt(15.0)) / 350, (124.0 + 7 * sqrt(15.0)) / 350, 256.0 / 525, (124.0 + 7 * sqrt(15.0)) / 350, (124.0 - 7 * sqrt(15.0)) / 350, 1.0 / 21]; foreach (i; 0 .. n) assert(x[i].approxEqual(xc[i])); foreach (i; 0 .. n) assert(w[i].approxEqual(wc[i]));
Gauss-Lobatto Quadrature