[][src]Function bacon_sci::special::legendre

pub fn legendre<N: ComplexField>(n: u32) -> Polynomial<N>

Get the nth legendre polynomial.

Gets the nth legendre polynomial over a specified field. This is done using the recurrence relation and is properly normalized.

Examples

use bacon_sci::special::legendre;
fn example() {
    let p_3 = legendre::<f64>(3);
    assert_eq!(p_3.order(), 3);
    assert!(p_3.get_coefficient(0).abs() < 0.00001);
    assert!((p_3.get_coefficient(1) + 1.5).abs() < 0.00001);
    assert!(p_3.get_coefficient(2).abs() < 0.00001);
    assert!((p_3.get_coefficient(3) - 2.5).abs() < 0.00001);
}