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
use crateTerm;
/// Represents a polynomial with a fixed number of variables and terms.
///
/// The polynomial is defined as a mathematical operation on `NUM_VARIABLES` variables. Each term is an instance of `Term<N>`,
/// encapsulating a coefficient and a set of variable functions.
///
/// # Type Parameters
///
/// - `NUM_VARIABLES`: Number of variables in the polynomial.
///
/// # Example
///
/// ```
/// use const_poly::VarFunction::*;
/// use const_poly::{const_poly, Polynomial};
///
/// // Create a polynomial, f(x,y) = 3 * sin(x) * cos(y)
/// const POLY: Polynomial<2> = const_poly!({[3.0, Sin, Cos]});
///
/// // Evaluate at x = π/2, y = 0 => 3 * sin(π/2) * cos(0) = 3 * 1 * 1 = 3
/// let result = POLY.evaluate(&[1.57079632679, 0.0]);
/// assert!((result - 3.0).abs() < 1e-6);
/// ```
/// --- Special case: Single-variable ---