smooth
A C++ library for Lie theory
Loading...
Searching...
No Matches
Functions
quadrature.hpp File Reference

Compile-time quadrature scheme generation. More...

#include <array>
#include <numbers>
#include <utility>
#include "basis.hpp"
#include "static_matrix.hpp"
Include dependency graph for quadrature.hpp:

Go to the source code of this file.

Functions

template<std::size_t K>
SMOOTH_BEGIN_NAMESPACE constexpr std::array< double, K > cgr_nodes ()
 Chebyshev-Gauss-Radau nodes on [-1, 1].
 
template<std::size_t K, std::size_t I = 8>
requires (K <= 40)
constexpr std::pair< std::array< double, K >, std::array< double, K > > lgr_nodes ()
 Legendre-Gauss-Radau (LGR) nodes and weights on [-1, 1].
 

Detailed Description

Compile-time quadrature scheme generation.

Definition in file quadrature.hpp.

Function Documentation

◆ cgr_nodes()

template<std::size_t K>
SMOOTH_BEGIN_NAMESPACE constexpr std::array< double, K > cgr_nodes ( )
constexpr

Chebyshev-Gauss-Radau nodes on [-1, 1].

Template Parameters
Knumber of points to generate

Definition at line 58 of file quadrature.hpp.

◆ lgr_nodes()

template<std::size_t K, std::size_t I = 8>
requires (K <= 40)
constexpr std::pair< std::array< double, K >, std::array< double, K > > lgr_nodes ( )
constexpr

Legendre-Gauss-Radau (LGR) nodes and weights on [-1, 1].

Warning
Only accurate up to approximately K = 40
Template Parameters
Knumber of points to generate
Inumber of Newton-Rhapson iterations
Returns
{xs, ws}

LGR nodes xs are the K roots of

\[ p_{K-1)(t)} + p_K(t), \]

where $p_i$ are Legendre polynomials. This functions obtains the LGR nodes via a fixed number of Newton iterations, using the CGR points as initial guesses.

The weight ws[0] for node 0 is 2 / K^2, for the remaining nodes the weights ws[k] are

\[ w_k = \frac{1}{(1 - x_k) [p_{K-1}(x_k)]^2} \]

Definition at line 88 of file quadrature.hpp.