@johnhenry/math 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/README.md +165 -0
  2. package/dist/Bivector4.d.ts +52 -0
  3. package/dist/Bivector4.d.ts.map +1 -0
  4. package/dist/Bivector4.js +105 -0
  5. package/dist/Bivector4.js.map +1 -0
  6. package/dist/CellGraph.d.ts +259 -0
  7. package/dist/CellGraph.d.ts.map +1 -0
  8. package/dist/CellGraph.js +637 -0
  9. package/dist/CellGraph.js.map +1 -0
  10. package/dist/Clifford4Internal.d.ts +35 -0
  11. package/dist/Clifford4Internal.d.ts.map +1 -0
  12. package/dist/Clifford4Internal.js +86 -0
  13. package/dist/Clifford4Internal.js.map +1 -0
  14. package/dist/Combinatorics.d.ts +61 -0
  15. package/dist/Combinatorics.d.ts.map +1 -0
  16. package/dist/Combinatorics.js +186 -0
  17. package/dist/Combinatorics.js.map +1 -0
  18. package/dist/CombinatoricsGenerators.d.ts +44 -0
  19. package/dist/CombinatoricsGenerators.d.ts.map +1 -0
  20. package/dist/CombinatoricsGenerators.js +148 -0
  21. package/dist/CombinatoricsGenerators.js.map +1 -0
  22. package/dist/ComplexMath.d.ts +46 -0
  23. package/dist/ComplexMath.d.ts.map +1 -0
  24. package/dist/ComplexMath.js +98 -0
  25. package/dist/ComplexMath.js.map +1 -0
  26. package/dist/ComplexNumber.d.ts +174 -0
  27. package/dist/ComplexNumber.d.ts.map +1 -0
  28. package/dist/ComplexNumber.js +443 -0
  29. package/dist/ComplexNumber.js.map +1 -0
  30. package/dist/Cycle.d.ts +42 -0
  31. package/dist/Cycle.d.ts.map +1 -0
  32. package/dist/Cycle.js +120 -0
  33. package/dist/Cycle.js.map +1 -0
  34. package/dist/Decimal.d.ts +45 -0
  35. package/dist/Decimal.d.ts.map +1 -0
  36. package/dist/Decimal.js +135 -0
  37. package/dist/Decimal.js.map +1 -0
  38. package/dist/Distributions.d.ts +55 -0
  39. package/dist/Distributions.d.ts.map +1 -0
  40. package/dist/Distributions.js +222 -0
  41. package/dist/Distributions.js.map +1 -0
  42. package/dist/DualNumber.d.ts +42 -0
  43. package/dist/DualNumber.d.ts.map +1 -0
  44. package/dist/DualNumber.js +91 -0
  45. package/dist/DualNumber.js.map +1 -0
  46. package/dist/Environment.d.ts +44 -0
  47. package/dist/Environment.d.ts.map +1 -0
  48. package/dist/Environment.js +129 -0
  49. package/dist/Environment.js.map +1 -0
  50. package/dist/Expression.d.ts +19 -0
  51. package/dist/Expression.d.ts.map +1 -0
  52. package/dist/Expression.js +43 -0
  53. package/dist/Expression.js.map +1 -0
  54. package/dist/FFT.d.ts +21 -0
  55. package/dist/FFT.d.ts.map +1 -0
  56. package/dist/FFT.js +136 -0
  57. package/dist/FFT.js.map +1 -0
  58. package/dist/GeometricAlgebra4.d.ts +73 -0
  59. package/dist/GeometricAlgebra4.d.ts.map +1 -0
  60. package/dist/GeometricAlgebra4.js +115 -0
  61. package/dist/GeometricAlgebra4.js.map +1 -0
  62. package/dist/Geometry.d.ts +41 -0
  63. package/dist/Geometry.d.ts.map +1 -0
  64. package/dist/Geometry.js +167 -0
  65. package/dist/Geometry.js.map +1 -0
  66. package/dist/Graph.d.ts +72 -0
  67. package/dist/Graph.d.ts.map +1 -0
  68. package/dist/Graph.js +337 -0
  69. package/dist/Graph.js.map +1 -0
  70. package/dist/Graph3DUtils.d.ts +80 -0
  71. package/dist/Graph3DUtils.d.ts.map +1 -0
  72. package/dist/Graph3DUtils.js +156 -0
  73. package/dist/Graph3DUtils.js.map +1 -0
  74. package/dist/GraphUtils.d.ts +67 -0
  75. package/dist/GraphUtils.d.ts.map +1 -0
  76. package/dist/GraphUtils.js +72 -0
  77. package/dist/GraphUtils.js.map +1 -0
  78. package/dist/GroupTheory.d.ts +73 -0
  79. package/dist/GroupTheory.d.ts.map +1 -0
  80. package/dist/GroupTheory.js +194 -0
  81. package/dist/GroupTheory.js.map +1 -0
  82. package/dist/IntUtils.d.ts +33 -0
  83. package/dist/IntUtils.d.ts.map +1 -0
  84. package/dist/IntUtils.js +185 -0
  85. package/dist/IntUtils.js.map +1 -0
  86. package/dist/Interval.d.ts +44 -0
  87. package/dist/Interval.d.ts.map +1 -0
  88. package/dist/Interval.js +165 -0
  89. package/dist/Interval.js.map +1 -0
  90. package/dist/Lattice.d.ts +48 -0
  91. package/dist/Lattice.d.ts.map +1 -0
  92. package/dist/Lattice.js +65 -0
  93. package/dist/Lattice.js.map +1 -0
  94. package/dist/Logic.d.ts +22 -0
  95. package/dist/Logic.d.ts.map +1 -0
  96. package/dist/Logic.js +34 -0
  97. package/dist/Logic.js.map +1 -0
  98. package/dist/MatrixMath.d.ts +71 -0
  99. package/dist/MatrixMath.d.ts.map +1 -0
  100. package/dist/MatrixMath.js +302 -0
  101. package/dist/MatrixMath.js.map +1 -0
  102. package/dist/NumberTheory.d.ts +49 -0
  103. package/dist/NumberTheory.d.ts.map +1 -0
  104. package/dist/NumberTheory.js +230 -0
  105. package/dist/NumberTheory.js.map +1 -0
  106. package/dist/Numerical.d.ts +85 -0
  107. package/dist/Numerical.d.ts.map +1 -0
  108. package/dist/Numerical.js +343 -0
  109. package/dist/Numerical.js.map +1 -0
  110. package/dist/Permutation.d.ts +43 -0
  111. package/dist/Permutation.d.ts.map +1 -0
  112. package/dist/Permutation.js +142 -0
  113. package/dist/Permutation.js.map +1 -0
  114. package/dist/Polygon.d.ts +64 -0
  115. package/dist/Polygon.d.ts.map +1 -0
  116. package/dist/Polygon.js +221 -0
  117. package/dist/Polygon.js.map +1 -0
  118. package/dist/PolynomialRing.d.ts +74 -0
  119. package/dist/PolynomialRing.d.ts.map +1 -0
  120. package/dist/PolynomialRing.js +231 -0
  121. package/dist/PolynomialRing.js.map +1 -0
  122. package/dist/Quaternion.d.ts +37 -0
  123. package/dist/Quaternion.d.ts.map +1 -0
  124. package/dist/Quaternion.js +106 -0
  125. package/dist/Quaternion.js.map +1 -0
  126. package/dist/Rational.d.ts +34 -0
  127. package/dist/Rational.d.ts.map +1 -0
  128. package/dist/Rational.js +136 -0
  129. package/dist/Rational.js.map +1 -0
  130. package/dist/RealMath.d.ts +112 -0
  131. package/dist/RealMath.d.ts.map +1 -0
  132. package/dist/RealMath.js +262 -0
  133. package/dist/RealMath.js.map +1 -0
  134. package/dist/Rotor4.d.ts +180 -0
  135. package/dist/Rotor4.d.ts.map +1 -0
  136. package/dist/Rotor4.js +388 -0
  137. package/dist/Rotor4.js.map +1 -0
  138. package/dist/SpecialFunctions.d.ts +32 -0
  139. package/dist/SpecialFunctions.d.ts.map +1 -0
  140. package/dist/SpecialFunctions.js +161 -0
  141. package/dist/SpecialFunctions.js.map +1 -0
  142. package/dist/SpecialOperator.d.ts +21 -0
  143. package/dist/SpecialOperator.d.ts.map +1 -0
  144. package/dist/SpecialOperator.js +26 -0
  145. package/dist/SpecialOperator.js.map +1 -0
  146. package/dist/Statistics.d.ts +50 -0
  147. package/dist/Statistics.d.ts.map +1 -0
  148. package/dist/Statistics.js +131 -0
  149. package/dist/Statistics.js.map +1 -0
  150. package/dist/StringEvaluator.d.ts +48 -0
  151. package/dist/StringEvaluator.d.ts.map +1 -0
  152. package/dist/StringEvaluator.js +190 -0
  153. package/dist/StringEvaluator.js.map +1 -0
  154. package/dist/Structure.d.ts +130 -0
  155. package/dist/Structure.d.ts.map +1 -0
  156. package/dist/Structure.js +394 -0
  157. package/dist/Structure.js.map +1 -0
  158. package/dist/Symbolic.d.ts +501 -0
  159. package/dist/Symbolic.d.ts.map +1 -0
  160. package/dist/Symbolic.js +4077 -0
  161. package/dist/Symbolic.js.map +1 -0
  162. package/dist/Type.d.ts +31 -0
  163. package/dist/Type.d.ts.map +1 -0
  164. package/dist/Type.js +47 -0
  165. package/dist/Type.js.map +1 -0
  166. package/dist/Utilities.d.ts +27 -0
  167. package/dist/Utilities.d.ts.map +1 -0
  168. package/dist/Utilities.js +47 -0
  169. package/dist/Utilities.js.map +1 -0
  170. package/dist/Vec4.d.ts +39 -0
  171. package/dist/Vec4.d.ts.map +1 -0
  172. package/dist/Vec4.js +82 -0
  173. package/dist/Vec4.js.map +1 -0
  174. package/dist/Vector.d.ts +83 -0
  175. package/dist/Vector.d.ts.map +1 -0
  176. package/dist/Vector.js +173 -0
  177. package/dist/Vector.js.map +1 -0
  178. package/dist/VectorCalculus.d.ts +42 -0
  179. package/dist/VectorCalculus.d.ts.map +1 -0
  180. package/dist/VectorCalculus.js +82 -0
  181. package/dist/VectorCalculus.js.map +1 -0
  182. package/dist/VectorUtils.d.ts +172 -0
  183. package/dist/VectorUtils.d.ts.map +1 -0
  184. package/dist/VectorUtils.js +706 -0
  185. package/dist/VectorUtils.js.map +1 -0
  186. package/dist/differentiation-rules.d.ts +21 -0
  187. package/dist/differentiation-rules.d.ts.map +1 -0
  188. package/dist/differentiation-rules.js +52 -0
  189. package/dist/differentiation-rules.js.map +1 -0
  190. package/dist/index.d.ts +52 -0
  191. package/dist/index.d.ts.map +1 -0
  192. package/dist/index.js +66 -0
  193. package/dist/index.js.map +1 -0
  194. package/package.json +68 -0
  195. package/src/Bivector4.ts +136 -0
  196. package/src/CellGraph.ts +669 -0
  197. package/src/Clifford4Internal.ts +90 -0
  198. package/src/Combinatorics.ts +183 -0
  199. package/src/CombinatoricsGenerators.ts +144 -0
  200. package/src/ComplexMath.ts +162 -0
  201. package/src/ComplexNumber.ts +491 -0
  202. package/src/Cycle.ts +126 -0
  203. package/src/Decimal.ts +145 -0
  204. package/src/Distributions.ts +269 -0
  205. package/src/DualNumber.ts +105 -0
  206. package/src/Environment.ts +127 -0
  207. package/src/Expression.ts +48 -0
  208. package/src/FFT.ts +146 -0
  209. package/src/GeometricAlgebra4.ts +157 -0
  210. package/src/Geometry.ts +173 -0
  211. package/src/Graph.ts +337 -0
  212. package/src/Graph3DUtils.ts +269 -0
  213. package/src/GraphUtils.ts +159 -0
  214. package/src/GroupTheory.ts +214 -0
  215. package/src/IntUtils.ts +200 -0
  216. package/src/Interval.ts +171 -0
  217. package/src/Lattice.ts +87 -0
  218. package/src/Logic.ts +38 -0
  219. package/src/MatrixMath.ts +326 -0
  220. package/src/NumberTheory.ts +228 -0
  221. package/src/Numerical.ts +390 -0
  222. package/src/Permutation.ts +148 -0
  223. package/src/Polygon.ts +229 -0
  224. package/src/PolynomialRing.ts +242 -0
  225. package/src/Quaternion.ts +125 -0
  226. package/src/Rational.ts +148 -0
  227. package/src/RealMath.ts +346 -0
  228. package/src/Rotor4.ts +440 -0
  229. package/src/SpecialFunctions.ts +152 -0
  230. package/src/SpecialOperator.ts +28 -0
  231. package/src/Statistics.ts +170 -0
  232. package/src/StringEvaluator.ts +208 -0
  233. package/src/Structure.ts +481 -0
  234. package/src/Symbolic.ts +4313 -0
  235. package/src/Type.ts +48 -0
  236. package/src/Utilities.ts +49 -0
  237. package/src/Vec4.ts +98 -0
  238. package/src/Vector.ts +189 -0
  239. package/src/VectorCalculus.ts +87 -0
  240. package/src/VectorUtils.ts +797 -0
  241. package/src/differentiation-rules.ts +73 -0
  242. package/src/index.ts +140 -0
@@ -0,0 +1,501 @@
1
+ import { Rational } from "./Rational.ts";
2
+ import type { Structure } from "./Structure.ts";
3
+ export type FuncName = "sin" | "cos" | "tan" | "exp" | "ln" | "sqrt" | "asin" | "acos" | "atan" | "sinh" | "cosh" | "tanh" | "cot" | "sec" | "csc" | "asinh" | "acosh" | "atanh" | "coth" | "sech" | "csch" | "acot" | "asec" | "acsc" | "acoth" | "asech" | "acsch" | "abs" | "log10" | "log2" | "cbrt" | "floor" | "ceil" | "round" | "sign" | "trunc" | "expm1" | "log1p" | "sigmoid" | "erf" | "relu";
4
+ /** Elementary functions that take exactly two `Expr` operands (see the `call2` `Expr` variant). */
5
+ export type BinaryFuncName = "atan2" | "hypot" | "min" | "max" | "gcd" | "lcm";
6
+ /** Comparison operators (see the `cmp` `Expr` variant). Evaluate to `1`/`0` (boolean-as-number). */
7
+ export type CmpOp = "lt" | "le" | "gt" | "ge" | "eq" | "ne";
8
+ export type Expr = {
9
+ type: "const";
10
+ value: number;
11
+ } | {
12
+ type: "var";
13
+ name: string;
14
+ } | {
15
+ type: "add";
16
+ left: Expr;
17
+ right: Expr;
18
+ } | {
19
+ type: "sub";
20
+ left: Expr;
21
+ right: Expr;
22
+ } | {
23
+ type: "mul";
24
+ left: Expr;
25
+ right: Expr;
26
+ } | {
27
+ type: "div";
28
+ left: Expr;
29
+ right: Expr;
30
+ } | {
31
+ type: "pow";
32
+ base: Expr;
33
+ exp: Expr;
34
+ } | {
35
+ type: "neg";
36
+ arg: Expr;
37
+ } | {
38
+ type: "func";
39
+ name: FuncName;
40
+ arg: Expr;
41
+ } | {
42
+ type: "call2";
43
+ name: BinaryFuncName;
44
+ left: Expr;
45
+ right: Expr;
46
+ } | {
47
+ type: "cmp";
48
+ op: CmpOp;
49
+ left: Expr;
50
+ right: Expr;
51
+ } | {
52
+ type: "piecewise";
53
+ branches: {
54
+ cond: Expr;
55
+ expr: Expr;
56
+ }[];
57
+ otherwise: Expr;
58
+ } | {
59
+ type: "sum";
60
+ variable: string;
61
+ from: Expr;
62
+ to: Expr;
63
+ body: Expr;
64
+ } | {
65
+ type: "product";
66
+ variable: string;
67
+ from: Expr;
68
+ to: Expr;
69
+ body: Expr;
70
+ };
71
+ /**
72
+ * Every function name {@link Symbolic.parse} recognizes — canonical spellings
73
+ * plus alternate ones like `arcsin` — for consumers (e.g. a UI's implicit-
74
+ * multiplication preprocessor) that need to know what counts as a known
75
+ * identifier without hand-duplicating this list.
76
+ */
77
+ export declare const FUNCTION_NAMES: readonly string[];
78
+ export type Assumption = "positive" | "negative" | "nonnegative" | "nonpositive" | "nonzero";
79
+ export declare class NotIntegrableError extends Error {
80
+ constructor(message?: string);
81
+ }
82
+ export declare class NonLinearSystemError extends Error {
83
+ constructor(message?: string);
84
+ }
85
+ export declare class SingularSystemError extends Error {
86
+ constructor(message?: string);
87
+ }
88
+ export declare class SeriesDivergesError extends Error {
89
+ constructor(message?: string);
90
+ }
91
+ export declare class UndeclaredVariableError extends Error {
92
+ readonly names: string[];
93
+ constructor(names: string[]);
94
+ }
95
+ export declare class SystemDidNotConvergeError extends Error {
96
+ constructor(message?: string);
97
+ }
98
+ export declare class IntegrationSingularityError extends Error {
99
+ constructor(message?: string);
100
+ }
101
+ /**
102
+ * No longer thrown internally -- `differentiate` now handles `product` via
103
+ * the logarithmic-derivative identity (see `diff`/`diffTraced`'s `case
104
+ * "product":`). Kept exported for backward compatibility with any code
105
+ * that imports/catches it.
106
+ */
107
+ export declare class ProductNotDifferentiableError extends Error {
108
+ constructor(message?: string);
109
+ }
110
+ export declare class NotSeparableError extends Error {
111
+ constructor(message?: string);
112
+ }
113
+ export declare class NoClosedFormError extends Error {
114
+ constructor(message?: string);
115
+ }
116
+ export declare class DegenerateOdeError extends Error {
117
+ constructor(message?: string);
118
+ }
119
+ /**
120
+ * Thrown by {@link Symbolic.solve} when `expr` is identically zero (e.g.
121
+ * `solve("0")`) -- every real number is a solution. Distinct from `[]`,
122
+ * which means "verified no real solution" (e.g. `x^2 + 1`).
123
+ */
124
+ export declare class InfiniteSolutionsError extends Error {
125
+ constructor(message?: string);
126
+ }
127
+ /**
128
+ * Result of {@link Symbolic.solveOdeClosedForm}. When the implicit relation
129
+ * produced by the chosen method (H(y) = G(x) + C, or the linear-ODE
130
+ * analog) can be algebraically solved for `y`, `explicit` is `true` and
131
+ * `y` holds that closed form. Otherwise `explicit` is `false` and
132
+ * `implicitRelation` holds an "expr implicitly equals zero" expression in
133
+ * both `x` and `y` (same zero-equals convention {@link Symbolic.solve}/
134
+ * {@link Symbolic.solveSystem} already use elsewhere in this file) --
135
+ * still a genuine closed-form solution, just not isolated for `y`.
136
+ */
137
+ export interface OdeClosedFormResult {
138
+ explicit: boolean;
139
+ y?: Expr;
140
+ implicitRelation?: Expr;
141
+ }
142
+ export declare class Symbolic {
143
+ /** Parse an expression string such as `"sin(x^2) + 3*x"` into an AST. */
144
+ static parse(input: string): Expr;
145
+ static differentiate(expr: Expr | string, variable?: string): Expr;
146
+ /**
147
+ * Like {@link differentiate}, but also returns a bottom-up trace of every
148
+ * differentiation rule applied — one step per subexpression, innermost
149
+ * first — for a "show your work" UI. Each step's `input`/`output` are
150
+ * unsimplified, matching the mechanical rule application; `result` is the
151
+ * final simplified derivative (same as `differentiate` would return).
152
+ */
153
+ static differentiateSteps(expr: Expr | string, variable?: string): {
154
+ steps: DifferentiationStep[];
155
+ result: Expr;
156
+ };
157
+ static simplify(expr: Expr | string): Expr;
158
+ /**
159
+ * Simplifies `expr` with additional domain knowledge about specific
160
+ * variables (e.g. "x is positive"), unlocking simplifications that aren't
161
+ * sound in general -- `sqrt(x^2) -> x` requires x >= 0 (otherwise the
162
+ * correct simplification is |x|), and `abs(x) -> x`/`-x` requires knowing
163
+ * x's sign. Runs ordinary `simplify` first, then a second tree-walk pass
164
+ * applying the specific patterns each assumption unlocks, then
165
+ * `simplify`s once more in case a rewrite exposes a further reduction
166
+ * (e.g. `sqrt(x^2)*2` -> `x*2` -> could combine with a like term
167
+ * elsewhere).
168
+ *
169
+ * NON-GOALS: a small, explicit pattern set (`sqrt(x^2)`, `abs(x)`), not a
170
+ * general constraint-propagation/theorem-proving simplifier; assumptions
171
+ * are a flat per-variable fact (`Assumption`), not compound/derived
172
+ * assumptions (e.g. "x+y is positive" isn't expressible).
173
+ */
174
+ static simplifyAssuming(expr: Expr | string, assumptions: Record<string, Assumption>): Expr;
175
+ /** Symbolic anti-derivative (elementary rules; throws {@link NotIntegrableError} otherwise). */
176
+ static integrate(expr: Expr | string, variable?: string): Expr;
177
+ /**
178
+ * Definite integral of `expr` over `[lower, upper]` with respect to
179
+ * `variable`. Tries the elementary symbolic antiderivative first
180
+ * (evaluating `F(upper) - F(lower)`); falls back to adaptive-Simpson
181
+ * numeric quadrature when {@link integrate} would throw
182
+ * {@link NotIntegrableError}. `env` binds any other free variables/
183
+ * constants appearing in `expr` (same convention as {@link evaluate}/
184
+ * {@link compile}); if `env` also happens to bind `variable`, the
185
+ * integration bound always wins.
186
+ *
187
+ * `lower > upper` needs no special-casing -- both the closed-form
188
+ * `F(upper) - F(lower)` and {@link Numerical.adaptiveSimpson} are
189
+ * antisymmetric in their two bounds (verified directly against
190
+ * `adaptiveSimpson`'s implementation), so reversed bounds just negate
191
+ * the result, matching the standard ∫[a,b] = -∫[b,a] convention.
192
+ *
193
+ * Detects (best-effort) a singularity strictly inside `(lower, upper)` --
194
+ * e.g. `1/x` from -1 to 1 -- via {@link hasInteriorSingularity} and throws
195
+ * {@link IntegrationSingularityError} rather than silently returning a
196
+ * finite-looking but meaningless value, for both the closed-form path (a
197
+ * naive `F(upper) - F(lower)` is wrong across a pole even when `F` itself
198
+ * evaluates to finite numbers at both ends) and the numeric fallback.
199
+ *
200
+ * NON-GOAL: the detector is a bounded-effort numeric heuristic (see its
201
+ * own doc comment), not an analytic proof -- a sufficiently narrow
202
+ * singularity can in principle still slip through uniform sampling.
203
+ *
204
+ * @throws {IntegrationSingularityError} if an interior singularity is detected.
205
+ */
206
+ static integrateDefinite(expr: Expr | string, lower: number, upper: number, variable?: string, env?: Record<string, number>): number;
207
+ /**
208
+ * Attempts a closed-form (symbolic) solution to the first-order initial
209
+ * value problem `dy/dx = dyDxExpr(x, y)`, `y(x0) = y0`, trying five
210
+ * elementary methods in order -- all built entirely on {@link integrate}'s
211
+ * existing elementary-rule coverage, not new integration machinery:
212
+ *
213
+ * 1. **Separable**: if `dyDxExpr` factors as `g(x)*h(y)` (including the
214
+ * degenerate cases `h(y)=1` or `g(x)=1`), integrates
215
+ * `∫(1/h(y))dy = ∫g(x)dx + C`, solves for `C` numerically from
216
+ * `(x0,y0)`, and tries to isolate `y`.
217
+ * 2. **Linear first-order**: if `dyDxExpr` is affine in `y` (i.e.
218
+ * `dy/dx + p(x)*y = q(x)` for some `p`,`q` depending only on `x`),
219
+ * solves via the integrating factor `μ(x)=exp(∫p(x)dx)`.
220
+ * 3. **Homogeneous**: if `dyDxExpr` depends only on the ratio `y/x`
221
+ * (tested by substituting `y=v·x` and checking whether `x` cancels
222
+ * out), the substitution reduces it to a separable equation in `v`
223
+ * and `x`, reusing method 1.
224
+ * 4. **Bernoulli**: if `dyDxExpr` has the shape `q(x)·y^n - p(x)·y`
225
+ * (`n != 0, 1`), the substitution `w=y^(1-n)` reduces it to a linear
226
+ * equation in `w` and `x`, reusing method 2.
227
+ * 5. **Exact**: if `dyDxExpr` is a quotient `P/Q`, cross-multiplying
228
+ * gives `M dx + N dy = 0` with `M=P`, `N=-Q`; when `∂M/∂y ≡ ∂N/∂x`
229
+ * (verified numerically at probe points), a potential function
230
+ * `F(x,y)` with `∂F/∂x=M`, `∂F/∂y=N` is constructed by integration,
231
+ * giving the (usually implicit) solution `F(x,y) = F(x0,y0)`.
232
+ * Deliberately tried LAST: the four methods above produce cleaner,
233
+ * usually-explicit results where they apply, and many equations match
234
+ * both (any separable quotient is also exact, for example) -- exact
235
+ * only picks up quotients none of the others could handle.
236
+ *
237
+ * All five paths legitimately fail on realistic inputs whose required
238
+ * antiderivative isn't in {@link integrate}'s elementary coverage -- that
239
+ * surfaces as {@link NoClosedFormError}. An equation matching none of the
240
+ * five structural patterns (e.g. a genuinely nonlinear/non-homogeneous
241
+ * case like a Riccati equation) surfaces as {@link NotSeparableError}.
242
+ * Second-order ODEs remain out of scope here (but see
243
+ * {@link solveOde2ndOrderConstCoeff} for the constant-coefficient
244
+ * homogeneous case).
245
+ *
246
+ * @throws {NotSeparableError} if no method's structural pattern matches.
247
+ * @throws {NoClosedFormError} if a method matches but its required integral(s) aren't elementary.
248
+ */
249
+ static solveOdeClosedForm(dyDxExpr: Expr | string, x0: number, y0: number, xVar?: string, yVar?: string): OdeClosedFormResult;
250
+ /**
251
+ * Closed-form solution to the second-order, constant-coefficient,
252
+ * *homogeneous* linear ODE `a*y'' + b*y' + c*y = 0`, given
253
+ * `y(x0)=y0`, `y'(x0)=yPrime0` -- a separate method from
254
+ * {@link solveOdeClosedForm} (not an extension of it): that method
255
+ * represents a first-order equation as a single `dy/dx=f(x,y)` `Expr`,
256
+ * but this file has no AST node for a second derivative, so a
257
+ * second-order equation is instead specified directly by its three
258
+ * numeric coefficients. Built directly from the characteristic
259
+ * equation's roots (`a*r^2+b*r+c=0`) via basic algebra -- no calls to
260
+ * {@link integrate}, unlike every first-order method above.
261
+ *
262
+ * Three cases by discriminant `disc = b^2 - 4ac`:
263
+ * 1. `disc > 0`: two distinct real roots `r1,r2`; general solution
264
+ * `y = C1*e^(r1*x) + C2*e^(r2*x)`, `C1`/`C2` from the 2x2 linear
265
+ * system the two initial conditions impose.
266
+ * 2. `disc ≈ 0` (tolerance `1e-9`): repeated root `r=-b/(2a)`; general
267
+ * solution `y = (C1+C2*x)*e^(r*x)`.
268
+ * 3. `disc < 0`: complex conjugate roots `α±iβ`; general solution
269
+ * `y = e^(α*x)*(C1*cos(β*x)+C2*sin(β*x))`.
270
+ *
271
+ * NON-GOALS: homogeneous only -- no forcing term `f(x)` on the
272
+ * right-hand side (a nonhomogeneous `a*y''+b*y'+c*y=f(x)` would need
273
+ * undetermined coefficients or variation of parameters, out of scope
274
+ * for this pass); no third-order-or-higher or non-constant-coefficient
275
+ * support.
276
+ *
277
+ * @throws {DegenerateOdeError} if `a === 0` (not actually second-order).
278
+ */
279
+ static solveOde2ndOrderConstCoeff(a: number, b: number, c: number, x0: number, y0: number, yPrime0: number): Expr;
280
+ /** Taylor expansion of `expr` about `center` up to `order`, as an expression. */
281
+ static taylor(expr: Expr | string, variable?: string, center?: number, order?: number): Expr;
282
+ /** Replace every occurrence of a variable with a sub-expression (e.g. for changing variables or plugging in a solved value). */
283
+ static substitute(expr: Expr | string, variable: string, replacement: Expr | string): Expr;
284
+ /** Distribute multiplication over addition/subtraction and expand small integer powers of sums, e.g. `(x+1)^2 -> x^2+2*x+1`. */
285
+ static expand(expr: Expr | string): Expr;
286
+ /**
287
+ * Every distinct variable name referenced anywhere in `expr`, sorted. This
288
+ * is auto-detection, not validation -- see {@link assertVariables} for a
289
+ * strict-mode check against a declared list.
290
+ */
291
+ static freeVariables(expr: Expr | string): string[];
292
+ /**
293
+ * Strict-mode companion to {@link freeVariables}: throws
294
+ * {@link UndeclaredVariableError} if `expr` references any variable
295
+ * outside `declared`. Useful to catch typos or ambiguous-parse fallout
296
+ * before they silently become spurious sliders/parameters or silently
297
+ * evaluate to `NaN`.
298
+ */
299
+ static assertVariables(expr: Expr | string, declared: string[]): void;
300
+ /**
301
+ * @param options.declaredVariables When provided, throws
302
+ * {@link UndeclaredVariableError} if `expr` references any variable
303
+ * outside this list, instead of the default behavior of silently
304
+ * resolving an undeclared variable to `NaN` via a missing `env` entry.
305
+ */
306
+ static evaluate(expr: Expr | string, env?: Record<string, number>, options?: {
307
+ declaredVariables?: string[];
308
+ }): number;
309
+ /**
310
+ * Compile `expr` into a closure tree, walking the AST once instead of on
311
+ * every call. Prefer this over {@link evaluate} when the same expression is
312
+ * evaluated many times (e.g. sampling a curve across hundreds of x values).
313
+ *
314
+ * @param options.declaredVariables Same strict-mode check as
315
+ * {@link evaluate}, checked once up front rather than per call.
316
+ */
317
+ static compile(expr: Expr | string, options?: {
318
+ declaredVariables?: string[];
319
+ }): (env: Record<string, number>) => number;
320
+ /**
321
+ * Evaluates `expr` exactly over {@link Rational} arithmetic instead of
322
+ * floats (e.g. `1/3` stays an exact fraction, not `0.333...`). Throws
323
+ * whenever the expression isn't exactly representable -- any `func`/
324
+ * `call2` node (sin/cos/sqrt/atan2/etc. are generally irrational) or a
325
+ * `pow` whose exponent isn't an integer -- so callers should fall back to
326
+ * a plain float evaluation on catch. `cmp` evaluates to exactly `1`/`0`
327
+ * via `Rational.compare`; `piecewise` selects the branch exactly (first
328
+ * `cond` whose Rational is nonzero).
329
+ */
330
+ static evaluateExact(expr: Expr | string, env?: Record<string, Rational>): Rational;
331
+ /**
332
+ * Evaluates `expr` by folding it through an arbitrary {@link Structure}'s
333
+ * own algebra instead of native JS math, so e.g. plotting can work over
334
+ * Z/7Z instead of the reals. Throws on any `func`/`call2` node (no
335
+ * general meaning over an abstract structure), a `pow` whose exponent
336
+ * isn't a literal integer constant, or an ordering comparison (`lt`/`le`/
337
+ * `gt`/`ge` -- several structures, e.g. quaternions, have no order
338
+ * compatible with their ring operations). `eq`/`ne` and `piecewise` work
339
+ * over any structure via its own `.equality()`.
340
+ */
341
+ static evaluateOverStructure<T>(expr: Expr | string, structure: Structure<T>, env?: Record<string, T>): T;
342
+ static toString(expr: Expr | string): string;
343
+ /** Render `expr` as a LaTeX string, e.g. `"x/2"` -> `"\\frac{x}{2}"`. */
344
+ static toLatex(expr: Expr | string): string;
345
+ /**
346
+ * Parse a LaTeX math string into an `Expr` — the reverse of {@link toLatex}.
347
+ * Round-trips everything `toLatex` produces: `\frac{a}{b}`, `\sqrt{a}` /
348
+ * `\sqrt[3]{a}` (as `cbrt`) / `\sqrt[n]{a}`, `\left(...\right)`,
349
+ * `\left|...\right|` (absolute value), `\left\lfloor...\right\rfloor` /
350
+ * `\left\lceil...\right\rceil`, `\log_{10}`/`\log_{2}`, `\cdot`/`\times`,
351
+ * `\pi`, `^{...}` exponents, `_{...}` subscripts, the named unary function
352
+ * commands (`\sin`, `\arcsin`, `\sinh`, `\operatorname{sech}`, ...), and the
353
+ * two-argument `BinaryFuncName` commands (`\min`, `\max`, `\gcd`,
354
+ * `\operatorname{atan2}`, `\operatorname{hypot}`, `\operatorname{lcm}`).
355
+ * Spacing commands (`\,`, `\;`, `\!`, `\quad`) are ignored.
356
+ *
357
+ * @throws on LaTeX constructs with no `Expr` equivalent, e.g. `\int` or `\sum`.
358
+ */
359
+ static fromLatex(latex: string): Expr;
360
+ /**
361
+ * Solve `expr = 0` for `variable`, returning every *real* root @johnhenry/math
362
+ * can find as an exact `Expr` (rationals and `sqrt`-radicals where
363
+ * possible) — complex roots are not returned (e.g. `x^2 + 1` yields `[]`).
364
+ * Supports polynomials up to degree 6: linear and quadratic are solved in
365
+ * closed form; degree ≥ 3 is solved by repeatedly finding a rational root
366
+ * (rational root theorem) and deflating via synthetic division, so a cubic
367
+ * or quartic with only irrational/complex roots left over after rational
368
+ * deflation cannot be fully solved this way.
369
+ *
370
+ * @throws if `expr` isn't a polynomial in `variable` of degree ≤ 6, or if a
371
+ * degree ≥ 3 factor has no rational root to deflate on.
372
+ * @throws {InfiniteSolutionsError} if `expr` is identically zero (e.g.
373
+ * `solve("0")`) -- every real number is a solution, a different result
374
+ * shape from `[]` (which means "verified no real solution").
375
+ */
376
+ static solve(expr: Expr | string, variable?: string): Expr[];
377
+ /**
378
+ * Solve a system of linear equations, each written in the same "expr
379
+ * implicitly equals zero" convention as {@link solve} (no `=` operator
380
+ * needed -- e.g. `"2*x + y - 5"` means `2x+y=5`). Requires exactly one
381
+ * equation per variable (a square system) with a unique solution.
382
+ *
383
+ * NON-GOAL (v1): nonlinear systems are not supported -- throws
384
+ * {@link NonLinearSystemError}. A future multivariable-Newton extension
385
+ * (seeded from an initial guess, iterating via the Jacobian) would slot in
386
+ * here as a fallback when linearity detection fails, but is out of scope now.
387
+ *
388
+ * @throws {NonLinearSystemError} if any equation isn't linear in `variables`.
389
+ * @throws {SingularSystemError} if the coefficient matrix is singular/rank-deficient.
390
+ */
391
+ static solveSystem(equations: (Expr | string)[], variables: string[]): Record<string, number>;
392
+ /**
393
+ * Numerically solves a square system of (possibly nonlinear) equations
394
+ * via multivariable Newton's method with a finite-difference Jacobian,
395
+ * starting from `initialGuess` (default: all 1s). Unlike `solveSystem`,
396
+ * this never throws `NonLinearSystemError` -- a genuinely linear system
397
+ * just converges in one Newton step, since Newton's method reduces to a
398
+ * single linear solve whenever the Jacobian is already constant. Added as
399
+ * a separate opt-in method (not `solveSystem`'s new default behavior) so
400
+ * `solveSystem`'s existing "throw on nonlinear" contract, and the tests
401
+ * that rely on it, stay unchanged -- callers who want a nonlinear-capable
402
+ * solve opt in explicitly.
403
+ *
404
+ * Each Newton step is damped by a backtracking line search: the full step
405
+ * is tried first, halved up to 20 times until it actually reduces the
406
+ * residual norm (or leaves the function's domain), rather than being
407
+ * taken unconditionally -- this is what keeps a merely-nearby (not
408
+ * exact) initial guess from overshooting past a real root, the concrete
409
+ * failure mode plain undamped Newton has no defense against.
410
+ *
411
+ * NON-GOALS: still no trust-region step (backtracking damps the step
412
+ * length but never changes its *direction* the way a trust region
413
+ * would), so a genuinely bad initial guess -- one on the wrong side of a
414
+ * local max/min of the residual, not just far from the root -- can still
415
+ * fail to converge; only ever finds one root near the initial guess, not
416
+ * every root of a system with multiple solutions.
417
+ *
418
+ * @throws {SystemDidNotConvergeError} if the residual doesn't shrink
419
+ * below tolerance within the iteration budget, if evaluation produces a
420
+ * non-finite value (e.g. leaving the function's domain) at some step,
421
+ * or if no damped step size improves the residual at some iterate.
422
+ */
423
+ static solveSystemNumeric(equations: (Expr | string)[], variables: string[], initialGuess?: number[]): Record<string, number>;
424
+ /**
425
+ * Numerically spot-checks that `candidate` is (approximately) a root of
426
+ * `equation` (the same "implicitly equals zero" convention `solve` uses):
427
+ * substitutes `candidate` for `variable` and checks the result is near
428
+ * zero. A lightweight reviewer/verification pass over a CAS result, not a
429
+ * proof of exactness -- catches an outright wrong candidate (e.g. from a
430
+ * heuristic search or a downstream bug) before it's presented, using the
431
+ * same probe-and-compare technique this codebase's own test suite already
432
+ * relies on for anything heuristic.
433
+ */
434
+ static verifySolution(equation: Expr | string, variable: string, candidate: number, env?: Record<string, number>, tolerance?: number): boolean;
435
+ /**
436
+ * The `solveSystem`/`solveSystemNumeric` analog of {@link verifySolution}:
437
+ * substitutes `solution` into every equation and requires all of them to
438
+ * land near zero.
439
+ */
440
+ static verifySystemSolution(equations: (Expr | string)[], solution: Record<string, number>, tolerance?: number): boolean;
441
+ /**
442
+ * Sum `expr` over integer values of `variable` from `from` to `to`
443
+ * (inclusive); `to` may be `Infinity` for an infinite series. A finite
444
+ * range is a plain partial sum. An infinite range first tries to recognize
445
+ * `expr` as a geometric series (`c·r^(a·variable+b)`, closed form
446
+ * `c·r^(a·from+b)/(1-r^a)`), falling back to numeric partial summation with
447
+ * a convergence/divergence check otherwise.
448
+ *
449
+ * `variable` defaults to `"n"` (not `"x"`), matching conventional
450
+ * summation-index notation.
451
+ *
452
+ * NON-GOALS: no general convergence-radius/ratio-test analysis beyond a
453
+ * simple term-growth divergence heuristic; no summation acceleration
454
+ * (Euler transform etc.) for slowly-converging or conditionally-convergent
455
+ * alternating series; closed-form recognition covers geometric series
456
+ * only, not arbitrary known series (no telescoping, no p-series/zeta
457
+ * recognition).
458
+ *
459
+ * If the term-magnitude stopping rule alone can't confirm convergence
460
+ * within the term budget (e.g. `Σ 1/n^2`, a slowly-decaying polynomial
461
+ * tail the per-term check isn't a valid proxy for), a second pass tries
462
+ * an integral-test tail bound instead of immediately declaring divergence:
463
+ * see {@link estimateConvergentTail}'s own doc comment for how. This
464
+ * recovers the correct value for a genuinely convergent slow-decay
465
+ * series without weakening the divergence check for a genuinely
466
+ * divergent one (e.g. `Σ 1/n`) -- the tail estimator itself confirms
467
+ * whether the integral is actually shrinking before trusting it.
468
+ *
469
+ * @throws {SeriesDivergesError} if the numeric fallback (including the
470
+ * integral-test tail estimate) still can't confirm convergence within
471
+ * its budget, or detects the terms growing.
472
+ */
473
+ static sumSeries(expr: Expr | string, from: number, to: number, variable?: string, env?: Record<string, number>): number;
474
+ /**
475
+ * Factor a polynomial in `variable`: extracts a common numeric GCD and
476
+ * common power of `variable`, then repeatedly pulls out rational linear
477
+ * factors `(variable - r)` via the rational root theorem, falling back to
478
+ * the quadratic formula for a final degree-2 remainder. Any remaining
479
+ * factor @johnhenry/math can't reduce further (e.g. an irreducible cubic) is
480
+ * left as-is. Returns `expr` unchanged (simplified) if it isn't a
481
+ * polynomial in `variable`.
482
+ */
483
+ static factor(expr: Expr | string, variable?: string): Expr;
484
+ /**
485
+ * Numeric limit of `expr` as `variable` approaches `point`. Falls back to
486
+ * L'Hopital's rule (repeated symbolic differentiation of numerator and
487
+ * denominator) whenever direct evaluation of a `div` node hits a `0/0` or
488
+ * `∞/∞` indeterminate form.
489
+ */
490
+ static limit(expr: Expr | string, variable?: string, point?: number, direction?: "left" | "right" | "both"): number;
491
+ }
492
+ /** One rule application recorded by {@link Symbolic.differentiateSteps}. */
493
+ export interface DifferentiationStep {
494
+ /** Human-readable name of the differentiation rule applied, e.g. "Product Rule". */
495
+ rule: string;
496
+ /** The subexpression this rule was applied to. */
497
+ input: Expr;
498
+ /** The (unsimplified) derivative of `input` produced by this rule. */
499
+ output: Expr;
500
+ }
501
+ //# sourceMappingURL=Symbolic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Symbolic.d.ts","sourceRoot":"","sources":["../src/Symbolic.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,QAAQ,GAChB,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,IAAI,GACJ,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,KAAK,GACL,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,KAAK,GACL,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,GACT,KAAK,GACL,MAAM,CAAC;AAEX,mGAAmG;AACnG,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE/E,oGAAoG;AACpG,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5D,MAAM,MAAM,IAAI,G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