mathhook_core/functions/
elementary.rs1pub mod abs;
7pub mod abs_eval;
8pub mod exp_eval;
9pub mod exponential;
10pub mod hyperbolic;
11pub mod hyperbolic_eval;
12pub mod log_eval;
13pub mod logarithmic;
14pub mod rounding;
15pub mod sqrt;
16pub mod sqrt_eval;
17pub mod trigonometric;
18
19use crate::functions::properties::FunctionProperties;
20use std::collections::HashMap;
21
22pub struct ElementaryIntelligence {
27 absolute_value: abs::AbsoluteValueIntelligence,
29
30 square_root: sqrt::SqrtIntelligence,
32
33 trigonometric: trigonometric::TrigonometricIntelligence,
35
36 exponential: exponential::ExponentialIntelligence,
38
39 logarithmic: logarithmic::LogarithmicIntelligence,
41
42 hyperbolic: hyperbolic::HyperbolicIntelligence,
44}
45
46impl Default for ElementaryIntelligence {
47 fn default() -> Self {
48 Self::new()
49 }
50}
51
52impl ElementaryIntelligence {
53 pub fn new() -> Self {
55 Self {
56 absolute_value: abs::AbsoluteValueIntelligence::new(),
57 square_root: sqrt::SqrtIntelligence::new(),
58 trigonometric: trigonometric::TrigonometricIntelligence::new(),
59 exponential: exponential::ExponentialIntelligence::new(),
60 logarithmic: logarithmic::LogarithmicIntelligence::new(),
61 hyperbolic: hyperbolic::HyperbolicIntelligence::new(),
62 }
63 }
64
65 pub fn get_all_properties(&self) -> HashMap<String, FunctionProperties> {
70 let mut properties = HashMap::with_capacity(32);
71
72 properties.extend(self.absolute_value.get_properties());
73 properties.extend(self.square_root.get_properties());
74 properties.extend(self.trigonometric.get_properties());
75 properties.extend(self.exponential.get_properties());
76 properties.extend(self.logarithmic.get_properties());
77 properties.extend(self.hyperbolic.get_properties());
78
79 properties
80 }
81
82 pub fn is_elementary_function(&self, name: &str) -> bool {
84 self.absolute_value.has_function(name)
85 || self.square_root.has_function(name)
86 || self.trigonometric.has_function(name)
87 || self.exponential.has_function(name)
88 || self.logarithmic.has_function(name)
89 || self.hyperbolic.has_function(name)
90 }
91}