1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//! Pole finding for rational and transcendental functions
//!
//! Implements algorithms to find poles of various types of functions using
//! the Universal Function Intelligence Registry.
use crate;
use crateget_universal_registry;
use crateFunctionProperties;
/// Parse reciprocal function name (e.g., "1/sin" -> Some("sin"))
///
/// # Arguments
///
/// * `name` - Function name to parse
///
/// # Returns
///
/// The base function name if this is a reciprocal, None otherwise
/// Find poles of rational functions by solving denominator = 0
///
/// # Arguments
///
/// * `_numerator` - The numerator expression (currently unused, for future enhancements)
/// * `denominator` - The denominator expression
/// * `variable` - The variable to solve for
///
/// # Returns
///
/// Vector of pole locations
///
/// # Examples
///
/// ```rust,ignore
/// use mathhook_core::{expr, symbol};
/// use mathhook_core::calculus::residues::pole_finding::find_rational_poles;
///
/// let x = symbol!(x);
/// let numerator = expr!(1);
/// let denominator = expr!(x - 2);
/// let poles = find_rational_poles(&numerator, &denominator, &x);
/// ```
/// Find poles of transcendental functions using Function Intelligence Registry
///
/// Retrieves pole information from the Universal Function Intelligence Registry
/// instead of hardcoding function names. This architectural pattern enables:
/// - O(1) registry lookup instead of O(n) match statements
/// - Extensibility: new functions auto-register their poles
/// - Single source of truth: poles defined with function properties
///
/// # Mathematical Background
///
/// **SymPy Validated: 2025-01-16**
///
/// Pole locations confirmed via SymPy limit analysis:
/// - `tan(x)`: poles at x = π/2 + nπ (principal pole: π/2)
/// - Validation: `lim(tan(x), x→π/2±) = ±∞`
/// - `cot(x)`: poles at x = nπ (principal pole: 0)
/// - Validation: `lim(cot(x), x→0±) = ±∞`
/// - `sec(x)`: poles at x = π/2 + nπ (principal pole: π/2)
/// - Validation: `lim(sec(x), x→π/2±) = ±∞`
/// - `csc(x)`: poles at x = nπ (principal pole: 0)
/// - Validation: `lim(csc(x), x→0±) = ±∞`
///
/// Each function returns its principal pole only. Full pole families follow
/// the periodic pattern: `principal_pole + n·period` where `n ∈ ℤ`.
///
/// # Arguments
///
/// * `name` - Function name
/// * `args` - Function arguments
/// * `variable` - Variable to find poles with respect to
///
/// # Returns
///
/// Vector of pole locations (typically returns the principal pole)
///
/// # Examples
///
/// ```rust,ignore
/// use mathhook_core::{expr, symbol};
/// use mathhook_core::calculus::residues::pole_finding::find_transcendental_poles;
///
/// let x = symbol!(x);
/// let poles = find_transcendental_poles("tan", &[expr!(x)], &x);
/// assert!(!poles.is_empty());
/// ```
/// Helper trait to convert function results to vectors