[][src]Function bacon_sci::special::chebyshev

pub fn chebyshev<N: ComplexField>(
    n: u32,
    tol: N::RealField
) -> Result<Polynomial<N>, String>

Get the nth chebyshev polynomial.

Gets the nth chebyshev polynomial over a specified field. This is done using the recursive formula and is properly normalized.

Examples

use bacon_sci::special::chebyshev;
fn example() {
    let t_3 = chebyshev::<f64>(3, 1e-8).unwrap();
    assert_eq!(t_3.order(), 3);
    assert!(t_3.get_coefficient(0).abs() < 0.00001);
    assert!((t_3.get_coefficient(1) + 3.0).abs() < 0.00001);
    assert!(t_3.get_coefficient(2).abs() < 0.00001);
    assert!((t_3.get_coefficient(3) - 4.0).abs() < 0.00001);
}