chebyshev_second

Function chebyshev_second 

Source
pub fn chebyshev_second<N: ComplexField + FromPrimitive + Copy>(
    n: u32,
    tol: N::RealField,
) -> Result<Polynomial<N>, String>
Expand description

Get the nth chebyshev polynomial of the second kind.

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

§Errors

Returns an error on invalid tolerance

§Panics

Panics if a u8 can not be transformed into the generic type.

§Examples

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