mathhook_core/functions/
polynomials.rs

1//! Polynomial Function Intelligence
2//!
3//! Dedicated module for polynomial families with complete mathematical properties,
4//! recurrence relations, orthogonality, and educational explanations.
5
6pub mod chebyshev;
7pub mod evaluation;
8pub mod hermite;
9pub mod laguerre;
10pub mod legendre;
11pub mod polynomial_eval;
12pub mod symbolic;
13
14pub use polynomial_eval::{degree, expand, factor, roots};
15
16use crate::functions::properties::FunctionProperties;
17use std::collections::HashMap;
18
19/// Polynomial Function Intelligence Registry
20///
21/// Manages mathematical intelligence for all polynomial families
22/// with proper modular separation by polynomial type.
23pub struct PolynomialIntelligence {
24    /// Legendre polynomials P_n(x)
25    legendre: legendre::LegendreIntelligence,
26
27    /// Hermite polynomials H_n(x)
28    hermite: hermite::HermiteIntelligence,
29
30    /// Laguerre polynomials L_n(x)
31    laguerre: laguerre::LaguerreIntelligence,
32
33    /// Chebyshev polynomials T_n(x), U_n(x)
34    chebyshev: chebyshev::ChebyshevIntelligence,
35}
36
37impl Default for PolynomialIntelligence {
38    fn default() -> Self {
39        Self::new()
40    }
41}
42
43impl PolynomialIntelligence {
44    /// Create new polynomial intelligence system
45    pub fn new() -> Self {
46        Self {
47            legendre: legendre::LegendreIntelligence::new(),
48            hermite: hermite::HermiteIntelligence::new(),
49            laguerre: laguerre::LaguerreIntelligence::new(),
50            chebyshev: chebyshev::ChebyshevIntelligence::new(),
51        }
52    }
53
54    /// Get all polynomial function properties
55    ///
56    /// Returns a HashMap of all polynomial functions and their properties
57    /// for integration with the universal registry.
58    pub fn get_all_properties(&self) -> HashMap<String, FunctionProperties> {
59        let mut properties = HashMap::with_capacity(64);
60
61        properties.extend(self.legendre.get_properties());
62        properties.extend(self.hermite.get_properties());
63        properties.extend(self.laguerre.get_properties());
64        properties.extend(self.chebyshev.get_properties());
65
66        properties
67    }
68
69    /// Check if function is a polynomial
70    pub fn is_polynomial_function(&self, name: &str) -> bool {
71        self.legendre.has_function(name)
72            || self.hermite.has_function(name)
73            || self.laguerre.has_function(name)
74            || self.chebyshev.has_function(name)
75    }
76}