mathtools.h File Reference
LibRPA
|
Basic mathematic tools for common tasks. More...
#include <cstddef>
Go to the source code of this file.
Functions | |
void | GaussChebyshevI_unit (size_t N, double *nodes, double *weights) |
Get the Gauss-Chebyshev quadrature based on Chebyshev points of the first type (kind) More... | |
void | GaussChebyshevII_unit (size_t N, double *nodes, double *weights) |
Get the Gauss-Chebyshev quadrature based on Chebyshev points of the second type (kind) More... | |
void | GaussLegendre_unit (size_t N, double *nodes, double *weights) |
Compute N-point Gauss-Legendre grids in [-1, 1];. More... | |
void | LegendreP_order_N (int N, double x, double &y, double &dy) |
Compute Legendre polynomial of order N at x in [-1, 1];. More... | |
void | transform_GaussQuad_unit2x0inf (double x0, size_t N, double *nodes, double *weights) |
Transform Gauss grids from [-1, 1] to [x0, infty]. More... | |
void | transform_GaussQuad_unit2x0x1 (double x0, double x1, size_t N, double *nodes, double *weights) |
Transform Gauss grids from [-1, 1] to [x0, x1]. More... | |
void | transform_GaussQuad_unit2inf (size_t N, double *nodes, double *weights) |
Transform Gauss grids from [-1, 1] to [-infty, infty]. More... | |
void | transform_GaussQuad_unit2minfx0 (double x0, size_t N, double *nodes, double *weights) |
Transform Gauss grids from [-1, 1] to [-infty, x0]. More... | |
Detailed Description
Basic mathematic tools for common tasks.
- Note
- Most functions are adapted from Gauss_Quadrature.cpp
Function Documentation
◆ GaussChebyshevI_unit()
void GaussChebyshevI_unit | ( | size_t | N, |
double * | nodes, | ||
double * | weights | ||
) |
Get the Gauss-Chebyshev quadrature based on Chebyshev points of the first type (kind)
- Parameters
-
N Number of grid points nodes Locations of grid points weights Weights of grid points
The nodes are zeros of order-N Chebyshev polynomials of first kind \(T_N(x)\) in \([-1,1]\):
\[ x_i = \cos(\frac{i + 0.5}{N}\pi) \]
The weight function is
\[ w(x) = \frac{1}{\sqrt{1-x^2}}. \]
with \(i = 0, 1, ..., N-1\).
◆ GaussChebyshevII_unit()
void GaussChebyshevII_unit | ( | size_t | N, |
double * | nodes, | ||
double * | weights | ||
) |
Get the Gauss-Chebyshev quadrature based on Chebyshev points of the second type (kind)
- Parameters
-
N Number of grid points nodes Locations of grid points weights Weights of grid points
The nodes are the local extrema of T_N(x) in [-1,1]: x_i = cos( i*PI /(N+1) ) The weght function w(x_i) = PI/(N+1) *sin^2 ( x^2_i ), with i = 1, ..., N.
◆ GaussLegendre_unit()
void GaussLegendre_unit | ( | size_t | N, |
double * | nodes, | ||
double * | weights | ||
) |
Compute N-point Gauss-Legendre grids in [-1, 1];.
- Parameters
-
N Number of grid points nodes Locations of grid points weights Weights of grid points
◆ LegendreP_order_N()
void LegendreP_order_N | ( | int | N, |
double | x, | ||
double & | y, | ||
double & | dy | ||
) |
Compute Legendre polynomial of order N at x in [-1, 1];.
- Parameters
-
N Order of polynomial x Grid point to evaluate the polynomial y Value of the polynomial at x dy value of the derivative of polynomial at x
The following recurrence relation is used: for n = 1, 2, ..., N, nL_n(x) = (2n-1)xL_{n-1}(x) - (n-1)L_{n-2}(x) (x^2-1)L'n(x) = nxL_n(x) - nL{n-1}(x)
◆ transform_GaussQuad_unit2inf()
void transform_GaussQuad_unit2inf | ( | size_t | N, |
double * | nodes, | ||
double * | weights | ||
) |
Transform Gauss grids from [-1, 1] to [-infty, infty].
- Parameters
-
N Number of grid points nodes Locations of grid points weights Weights of grid points
Transform from [-1,1] to [-inf,inf] x' = x/(1-x^2) wx' = (1+x^2)/(1-x^2)^2 *wx
◆ transform_GaussQuad_unit2minfx0()
void transform_GaussQuad_unit2minfx0 | ( | double | x0, |
size_t | N, | ||
double * | nodes, | ||
double * | weights | ||
) |
Transform Gauss grids from [-1, 1] to [-infty, x0].
- Parameters
-
x0 right end of the targeted region N Number of grid points nodes Locations of grid points weights Weights of grid points
Transform from [-1,1] to [-inf,x0] wx' = 1 / (1+x)^2 *wx x' = 0.5 * (x-1)/(1+x) + x0
◆ transform_GaussQuad_unit2x0inf()
void transform_GaussQuad_unit2x0inf | ( | double | x0, |
size_t | N, | ||
double * | nodes, | ||
double * | weights | ||
) |
Transform Gauss grids from [-1, 1] to [x0, infty].
- Parameters
-
x0 Left end of the targeted region N Number of grid points nodes Locations of grid points weights Weights of grid points
◆ transform_GaussQuad_unit2x0x1()
void transform_GaussQuad_unit2x0x1 | ( | double | x0, |
double | x1, | ||
size_t | N, | ||
double * | nodes, | ||
double * | weights | ||
) |
Transform Gauss grids from [-1, 1] to [x0, x1].
- Parameters
-
x0 Left end of the targeted region x1 Right end of the targeted region N Number of grid points nodes Locations of grid points weights Weights of grid points
Transform from [-1,1] to [x0,x1] x' = (x1-x0)/2 *x + (x0+x1)/2 wx' = (x1-x0)/2 *wx
Generated by