Method
NumCosmoMathSpectralcompute_chebyshev_coeffs_adaptive_weighted
Declaration [src]
guint
ncm_spectral_compute_chebyshev_coeffs_adaptive_weighted (
NcmSpectral* spectral,
NcmSpectralF F,
gdouble a,
gdouble b,
guint k_min,
gdouble tol,
GArray** coeffs,
gpointer user_data
)
Description [src]
Computes Chebyshev coefficients of $F(x(t)) \sqrt{1-t^2} h$ adaptively using nested Chebyshev-Lobatto nodes, where $h = (b-a)/2$. The weight factor $\sqrt{1-t^2} \cdot h$ enables direct integral computation: the integral $\int_a^b F(x)dx = \pi \cdot$ coeffs[0].
This weighted expansion enables efficient computation of integrals: $\int_a^b F(x)G(x)dx$ can be computed from the weighted coefficients of $F$ and the standard coefficients of $G$.
At Chebyshev-Lobatto nodes $t_j = \cos(j\pi/2^k)$, the weight is $\sqrt{1-t_j^2} = \sin(j\pi/2^k)$.
The function F is evaluated at points x in [a,b]. Starts at level k_min and refines
by doubling until spectral convergence is achieved or max_order is reached.
If coeffs points to NULL, allocates a new GArray. If coeffs points to an existing
GArray, resizes it as needed. Through bindings, coeffs always receives NULL.
Parameters
F-
Type:
NcmSpectralFFunction to evaluate, receives x in [a,b].
a-
Type:
gdoubleLeft endpoint of the interval.
b-
Type:
gdoubleRight endpoint of the interval.
k_min-
Type:
guintMinimum refinement level (N_min = 2^
k_min+ 1). tol-
Type:
gdoubleSpectral convergence tolerance.
coeffs-
Type: An array of
doubleOutput array of coefficients.
The argument will be set by the function. The caller of the method takes ownership of the returned data, and is responsible for freeing it. user_data-
Type:
gpointerUser data for
F.The argument can be NULL.The data is owned by the caller of the method.