pub struct ChebyshevCollocation {
pub n: usize,
}Expand description
Chebyshev collocation method for 1D boundary value problems.
Sets up the collocation differentiation matrix on Chebyshev-Gauss-Lobatto
nodes and solves second-order BVPs of the form
p(x) u'' + q(x) u' + r(x) u = g(x) with Dirichlet boundary conditions.
Fields§
§n: usizeNumber of interior collocation points (polynomial degree = n+1).
Implementations§
Source§impl ChebyshevCollocation
impl ChebyshevCollocation
Sourcepub fn new(n: usize) -> Self
pub fn new(n: usize) -> Self
Construct a collocation scheme with n Chebyshev-Gauss-Lobatto points.
Sourcepub fn nodes(&self) -> Vec<f64>
pub fn nodes(&self) -> Vec<f64>
Return the collocation nodes (Chebyshev-Gauss-Lobatto on [-1, 1]).
Sourcepub fn diff_matrix(&self) -> Vec<Vec<f64>>
pub fn diff_matrix(&self) -> Vec<Vec<f64>>
Return the first-derivative spectral differentiation matrix D of size n x n.
Sourcepub fn solve_poisson<G>(&self, g: G, bc_left: f64, bc_right: f64) -> Vec<f64>
pub fn solve_poisson<G>(&self, g: G, bc_left: f64, bc_right: f64) -> Vec<f64>
Solve the 1D Poisson equation u'' = g(x) on [-1, 1] with
Dirichlet boundary conditions u(-1) = bc_left, u(1) = bc_right.
Uses the Chebyshev spectral differentiation matrix; applies boundary
conditions by replacing the first and last rows. Returns u at all
collocation nodes.
Auto Trait Implementations§
impl Freeze for ChebyshevCollocation
impl RefUnwindSafe for ChebyshevCollocation
impl Send for ChebyshevCollocation
impl Sync for ChebyshevCollocation
impl Unpin for ChebyshevCollocation
impl UnsafeUnpin for ChebyshevCollocation
impl UnwindSafe for ChebyshevCollocation
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.