#pragma once // Copyright (c) 2024-2026 Tarik Moussa. // SPDX-License-Identifier: MIT // gauss_legendre.hpp // // 10-point Gauss-Legendre quadrature nodes and weights on [-1,1]. // // Previously duplicated verbatim in: // euclidean_functional.hpp, spherical_functional.hpp, // inversive_distance_functional.hpp (MINOR-3 fix) // // Usage (integration over [0,1] via change of variables t=(1+s)/2, w=w_GL/2): // // const auto* s = conformallab::gl10_nodes(); // const auto* w = conformallab::gl10_weights(); // for (int k = 0; k < 10; ++k) { // double t = (1.0 + s[k]) * 0.5; // double wt = w[k] * 0.5; // E += wt * dot(G(t*x), x); // } namespace conformallab { /// 10-point Gauss-Legendre nodes on [−1, 1]. inline const double* gl10_nodes() noexcept { static constexpr double s[10] = { -0.9739065285171717, -0.8650633666889845, -0.6794095682990244, -0.4333953941292472, -0.1488743389816312, 0.1488743389816312, 0.4333953941292472, 0.6794095682990244, 0.8650633666889845, 0.9739065285171717 }; return s; } /// 10-point Gauss-Legendre weights on [−1, 1]. inline const double* gl10_weights() noexcept { static constexpr double w[10] = { 0.0666713443086881, 0.1494513491505806, 0.2190863625159820, 0.2692667193099963, 0.2955242247147529, 0.2955242247147529, 0.2692667193099963, 0.2190863625159820, 0.1494513491505806, 0.0666713443086881 }; return w; } } // namespace conformallab