pub struct ChebyshevPolynomial;Expand description
Chebyshev polynomials of the first kind: T_n(x).
Provides evaluation via the three-term recurrence, Chebyshev nodes on [-1, 1], differentiation matrix for spectral differentiation, and interpolation coefficients from function values at Chebyshev nodes.
Implementations§
Source§impl ChebyshevPolynomial
impl ChebyshevPolynomial
Sourcepub fn eval(n: usize, x: f64) -> f64
pub fn eval(n: usize, x: f64) -> f64
Evaluate T_n(x) using the recurrence T_0=1, T_1=x, T_{n+1}=2x T_n - T_{n-1}.
Sourcepub fn eval_all(n: usize, x: f64) -> Vec<f64>
pub fn eval_all(n: usize, x: f64) -> Vec<f64>
Evaluate all Chebyshev polynomials T_0(x), …, T_n(x).
Sourcepub fn nodes(n: usize) -> Vec<f64>
pub fn nodes(n: usize) -> Vec<f64>
Return the n+1 Chebyshev-Gauss-Lobatto nodes on [-1, 1]:
x_j = cos(j*pi/n), j = 0, …, n.
Sourcepub fn gauss_nodes(n: usize) -> Vec<f64>
pub fn gauss_nodes(n: usize) -> Vec<f64>
Return the n interior Chebyshev-Gauss nodes on (-1, 1):
x_j = cos((2j+1)*pi / (2n)), j = 0, …, n-1.
Sourcepub fn diff_matrix(n: usize) -> Vec<Vec<f64>>
pub fn diff_matrix(n: usize) -> Vec<Vec<f64>>
Compute the (n+1) x (n+1) spectral differentiation matrix at
Chebyshev-Gauss-Lobatto nodes.
The entry D[i][j] approximates the derivative of the j-th basis
function at node x_i.
Sourcepub fn interpolation_coeffs(vals: &[f64]) -> Vec<f64>
pub fn interpolation_coeffs(vals: &[f64]) -> Vec<f64>
Compute Chebyshev expansion coefficients from function values at Chebyshev-Gauss-Lobatto nodes using the DCT-I formula.
Returns coefficients a_k such that f(x) ≈ Σ a_k T_k(x).
Sourcepub fn eval_series(coeffs: &[f64], x: f64) -> f64
pub fn eval_series(coeffs: &[f64], x: f64) -> f64
Evaluate the Chebyshev series with coefficients coeffs at point x.
Auto Trait Implementations§
impl Freeze for ChebyshevPolynomial
impl RefUnwindSafe for ChebyshevPolynomial
impl Send for ChebyshevPolynomial
impl Sync for ChebyshevPolynomial
impl Unpin for ChebyshevPolynomial
impl UnsafeUnpin for ChebyshevPolynomial
impl UnwindSafe for ChebyshevPolynomial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.