@ac-kit/math-analysis 0.1.11 → 0.2.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 (35) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +82 -8
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +4 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/roots/_brent-kernel.d.ts +38 -0
  8. package/dist/roots/_brent-kernel.d.ts.map +1 -0
  9. package/dist/roots/_brent-kernel.js +112 -0
  10. package/dist/roots/_brent-kernel.js.map +1 -0
  11. package/dist/roots/_grown.d.ts +7 -0
  12. package/dist/roots/_grown.d.ts.map +1 -0
  13. package/dist/roots/_grown.js +20 -0
  14. package/dist/roots/_grown.js.map +1 -0
  15. package/dist/roots/_level-search.d.ts +137 -0
  16. package/dist/roots/_level-search.d.ts.map +1 -0
  17. package/dist/roots/_level-search.js +532 -0
  18. package/dist/roots/_level-search.js.map +1 -0
  19. package/dist/roots/brent.d.ts +59 -0
  20. package/dist/roots/brent.d.ts.map +1 -0
  21. package/dist/roots/brent.js +115 -0
  22. package/dist/roots/brent.js.map +1 -0
  23. package/dist/roots/find-level-bands.d.ts +148 -0
  24. package/dist/roots/find-level-bands.d.ts.map +1 -0
  25. package/dist/roots/find-level-bands.js +351 -0
  26. package/dist/roots/find-level-bands.js.map +1 -0
  27. package/dist/roots/find-level-crossings.d.ts +141 -0
  28. package/dist/roots/find-level-crossings.d.ts.map +1 -0
  29. package/dist/roots/find-level-crossings.js +168 -0
  30. package/dist/roots/find-level-crossings.js.map +1 -0
  31. package/dist/roots/level-search-options.d.ts +56 -0
  32. package/dist/roots/level-search-options.d.ts.map +1 -0
  33. package/dist/roots/level-search-options.js +2 -0
  34. package/dist/roots/level-search-options.js.map +1 -0
  35. package/package.json +6 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,71 @@
1
1
  # @ac-kit/math-analysis
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0b4fe43: `brent(f, lower, upper, options?)` finds a root inside a sign-changing bracket
8
+ with Brent's 1973 algorithm: the root stays bracketed, convergence is
9
+ superlinear on a smooth root and never much worse than bisection. The result
10
+ is within `4ε|x| + 2 · tolerance` of a root (`tolerance` defaults to `0`: what
11
+ binary64 can resolve). It accepts the bracket in either order, throws
12
+ `RangeError` for a bracket without a sign change, non-finite ends or a `NaN`
13
+ from `f`, and `ConvergenceError` only when a caller's `maxIterations` runs out.
14
+
15
+ `findLevelCrossings(f, lower, upper, { maxRate, level?, resolution?,
16
+ tolerance?, integer?, budget?, signal? }, out?)` returns every crossing of a
17
+ level, certified by a bound `maxRate` on `|f′|`: as `LevelCrossings` columns
18
+ (`times`, `directions`, `earliestTimes`/`latestTimes` enclosures, `startSide`),
19
+ plus the `unresolved` intervals where a touch cannot be decided, never guessed.
20
+ With `integer: true`, a crossing is the first integer on the new side.
21
+ `findLevelBands(f, lower, upper, bands, options, out?)` returns, per band
22
+ `[low, high)`, the sorted half-open intervals where `low ≤ f < high`, the
23
+ enclosures of their ends and the band's unresolved intervals, searching every
24
+ edge in one subdivision. Both evaluate `f` at most `2 + 4 · (upper − lower) /
25
+ resolution` times to isolate the crossings, plus a bounded refinement per
26
+ crossing; charge a `WorkBudget` per evaluation; honour an `AbortSignal`; and
27
+ allocate nothing once a reused `out` has grown. `LevelSearchOptions` and
28
+ `LevelCrossingsOptions` type the options. The package now depends on
29
+ `@ac-kit/algo`.
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [0b4fe43]
34
+ - Updated dependencies [0b4fe43]
35
+ - Updated dependencies [0b4fe43]
36
+ - Updated dependencies [0b4fe43]
37
+ - Updated dependencies [0b4fe43]
38
+ - Updated dependencies [0b4fe43]
39
+ - Updated dependencies [0b4fe43]
40
+ - Updated dependencies [0b4fe43]
41
+ - Updated dependencies [0b4fe43]
42
+ - Updated dependencies [0b4fe43]
43
+ - Updated dependencies [0b4fe43]
44
+ - Updated dependencies [0b4fe43]
45
+ - Updated dependencies [0b4fe43]
46
+ - Updated dependencies [0b4fe43]
47
+ - Updated dependencies [0b4fe43]
48
+ - Updated dependencies [0b4fe43]
49
+ - Updated dependencies [0b4fe43]
50
+ - Updated dependencies [0b4fe43]
51
+ - Updated dependencies [0b4fe43]
52
+ - Updated dependencies [0b4fe43]
53
+ - Updated dependencies [0b4fe43]
54
+ - Updated dependencies [0b4fe43]
55
+ - Updated dependencies [0b4fe43]
56
+ - Updated dependencies [0b4fe43]
57
+ - Updated dependencies [0b4fe43]
58
+ - Updated dependencies [0b4fe43]
59
+ - Updated dependencies [0b4fe43]
60
+ - Updated dependencies [0b4fe43]
61
+ - Updated dependencies [0b4fe43]
62
+ - Updated dependencies [0b4fe43]
63
+ - Updated dependencies [0b4fe43]
64
+ - Updated dependencies [0b4fe43]
65
+ - @ac-kit/algo@0.6.0
66
+ - @ac-kit/core@0.13.0
67
+ - @ac-kit/math-scalar@0.4.0
68
+
3
69
  ## 0.1.11
4
70
 
5
71
  ### Patch Changes
package/README.md CHANGED
@@ -17,7 +17,10 @@ sequences live in `@ac-kit/math-signal`.
17
17
 
18
18
  | Symbol | Description | Convergence |
19
19
  | --------------------------------------------- | ------------------------------------------------------------ | ---------------------- |
20
+ | `brent(f, lower, upper, options)` | Root within a sign-changing bracket, Brent's 1973 algorithm | superlinear, never much worse than bisection |
20
21
  | `bisect(f, lower, upper, options)` | Root of a continuous function within a sign-changing bracket | linear, `(b − a) / 2ⁿ` |
22
+ | `findLevelCrossings(f, lower, upper, options)` | Every crossing of a level, certified by a bound on `\|f′\|` | see below |
23
+ | `findLevelBands(f, lower, upper, bands, options)` | Where `low ≤ f < high`, for several bands at once, certified | see below |
21
24
  | `trapezoidalRule(f, lower, upper, intervals)` | Definite integral by piecewise linear approximation | `O(h²)` |
22
25
  | `continuedFractionEval(fraction, options)` | Value of a continued fraction, by modified Lentz | forward, no truncation guess |
23
26
 
@@ -47,19 +50,90 @@ is exactly `1` in binary64, while `erfc(10)` is `2.09e-45` and correct.
47
50
 
48
51
  ## Reliability over speed
49
52
 
50
- `bisect` converges linearly, which is slow next to Newton's quadratic rate. It
51
- is nonetheless the right default: given a bracket where `f` changes sign, the
52
- intermediate value theorem guarantees a root inside, and bisection cannot fail
53
- to find it. Newton's method diverges from a poor starting point, stalls at
54
- inflection points, and needs a derivative. Faster methods belong here too, but
55
- as explicit choices, not as the default.
53
+ Given a bracket where `f` changes sign, the intermediate value theorem
54
+ guarantees a root inside, and bisection cannot fail to find it — but it buys
55
+ one bit per evaluation. `brent` keeps that guarantee (the root stays
56
+ bracketed, and Brent proves it never needs more than about N² evaluations
57
+ where bisection needs N) while interpolating its way to a smooth root in a
58
+ handful of steps, so it is the root finder to reach for. Its tolerance is
59
+ Brent's: the result is within `4ε|x| + 2 · tolerance` of a root, and the
60
+ default `tolerance: 0` asks for what binary64 can resolve. Newton's method,
61
+ faster still, diverges from a poor starting point, stalls at inflection points
62
+ and needs a derivative; it belongs here as an explicit choice, never the
63
+ default.
64
+
65
+ ## Certified level crossings
66
+
67
+ Sampling a function at a fixed step and watching for sign changes misses any
68
+ excursion shorter than the step, and nothing says so. `findLevelCrossings`
69
+ takes a bound `maxRate` on `|f′|` instead, and with it a certificate: between
70
+ two samples `a` and `b`, `|f(a) − level| + |f(b) − level| > maxRate · (b − a)`
71
+ proves that `f` cannot reach the level. Certified stretches are skipped whole,
72
+ the rest bisected down to `resolution`, each sign change refined by `brent`
73
+ (or, with `integer: true`, to the first integer on the new side through
74
+ `@ac-kit/algo`'s `binarySearch`).
75
+
76
+ ```ts
77
+ import { findLevelCrossings } from "@ac-kit/math-analysis";
78
+
79
+ const crossings = findLevelCrossings(altitude, startMs, endMs, {
80
+ level: -0.833, // degrees: sunrise and sunset
81
+ maxRate: 400 / 86_400_000, // the Sun never moves faster, in degrees a ms
82
+ resolution: 60_000, // examine touches down to a minute
83
+ integer: true, // epoch milliseconds
84
+ });
85
+ for (let index = 0; index < crossings.count; index++) {
86
+ crossings.times[index]; // the first millisecond on the new side
87
+ crossings.directions[index]; // 1 rising, -1 setting
88
+ }
89
+ ```
90
+
91
+ What comes back is never a guess:
92
+
93
+ - **Crossings**, as columns (`times`, `directions`), with the side of `f` at
94
+ `lower` in `startSide`. Each crossing carries an **enclosure**
95
+ `[earliestTimes[i], latestTimes[i]]` holding every zero of its cluster: `f`
96
+ is certified on the old side before it and on the new side after. A crossing
97
+ at a slope near `maxRate` is enclosed within `resolution`; a slow one more
98
+ loosely, since a loose bound cannot rule out a brief return there.
99
+ - **Unresolved intervals** (`unresolvedStarts`, `unresolvedEnds`): stretches
100
+ away from any crossing where `f` may touch the level and come back — a
101
+ tangent, or a dip shorter than `resolution` — which the bound cannot decide.
102
+ A tangent leaves one about `2 · √(resolution · maxRate / |f″|)` wide.
103
+
104
+ Everywhere else the side of `f` is certified, provided `maxRate` truly bounds
105
+ `|f′|`. A bound that is too small, or a jump, can hide a crossing and its
106
+ return inside an interval it certified; a sign change between samples is still
107
+ found (at the jump, for a discontinuity), and every reported crossing is a real
108
+ sign change in either case.
109
+
110
+ The search is bounded: at most `2 + 2 · (upper − lower) / resolution`
111
+ evaluations (`4 ·` in integer mode) isolate the crossings, since no interval
112
+ narrower than `resolution` is split, and far fewer in practice — a stretch
113
+ where `|f − level| ≥ c` is certified in pieces `2c / maxRate` wide. Each
114
+ crossing then costs Brent's own bound, or `⌈log₂ resolution⌉` in integer mode.
115
+ A `WorkBudget` is charged one unit per evaluation and an `AbortSignal` checked
116
+ before each.
117
+
118
+ `findLevelBands(f, lower, upper, bands, options)` answers the question one
119
+ level up: for each band `[low, high)`, the sorted half-open intervals where
120
+ `low ≤ f < high`, with the enclosures of their ends and the band's unresolved
121
+ intervals. All the band edges are searched in one subdivision, so `f` is
122
+ evaluated once per point whatever the number of bands, and an edge shared by
123
+ two bands — golden hour's lower edge and blue hour's upper one — once.
124
+
125
+ Both write into a result object that can be passed back in (`out`): once its
126
+ columns have grown to the answer, a search allocates nothing. As anywhere in
127
+ V8, a double crossing a call the engine does not inline is boxed by its caller:
128
+ `f`'s result, unless `f` is inlined, and the arguments of a call site that has
129
+ seen many shapes of `f` or of the options object are the caller's allocations.
56
130
 
57
131
  ## Usage
58
132
 
59
133
  ```ts
60
- import { bisect, trapezoidalRule } from "@ac-kit/math-analysis";
134
+ import { brent, trapezoidalRule } from "@ac-kit/math-analysis";
61
135
 
62
- bisect((x) => x * x - 2, 0, 2); // ≈ 1.4142135623…
136
+ brent((x) => x * x - 2, 0, 2); // ≈ 1.4142135623…
63
137
  trapezoidalRule(Math.sin, 0, Math.PI); // ≈ 2
64
138
  ```
65
139
 
package/dist/index.d.ts CHANGED
@@ -14,5 +14,9 @@ export * from "./log-gamma.js";
14
14
  export * from "./regularized-incomplete-beta.js";
15
15
  export * from "./regularized-incomplete-gamma-upper.js";
16
16
  export * from "./regularized-incomplete-gamma.js";
17
+ export * from "./roots/brent.js";
18
+ export * from "./roots/find-level-bands.js";
19
+ export * from "./roots/find-level-crossings.js";
20
+ export * from "./roots/level-search-options.js";
17
21
  export * from "./trapezoidal-rule.js";
18
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,9 @@ export * from "./log-gamma.js";
14
14
  export * from "./regularized-incomplete-beta.js";
15
15
  export * from "./regularized-incomplete-gamma-upper.js";
16
16
  export * from "./regularized-incomplete-gamma.js";
17
+ export * from "./roots/brent.js";
18
+ export * from "./roots/find-level-bands.js";
19
+ export * from "./roots/find-level-crossings.js";
20
+ export * from "./roots/level-search-options.js";
17
21
  export * from "./trapezoidal-rule.js";
18
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0CAA0C,CAAC;AACzD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * What the Brent kernel works on. Every number goes through a field rather than
3
+ * an argument or a return value: a double crossing a call the engine does not
4
+ * inline is boxed, and the kernel must allocate nothing.
5
+ */
6
+ export interface BrentState_ {
7
+ /** In: the bracket and the values at its ends, of opposite signs or zero. */
8
+ lower: number;
9
+ upper: number;
10
+ lowerValue: number;
11
+ upperValue: number;
12
+ /** In: the absolute part `t` of the stopping test. */
13
+ tolerance: number;
14
+ /** Written by the kernel before each {@link evaluate}. */
15
+ x: number;
16
+ /** Written by {@link evaluate}: the function at {@link x}. */
17
+ value: number;
18
+ /** Out: the root. */
19
+ root: number;
20
+ evaluate(): void;
21
+ }
22
+ /**
23
+ * Brent's `zero` (Algorithms for Minimization without Derivatives, 1973,
24
+ * chapter 4), over a bracket whose values are already known.
25
+ *
26
+ * Writes to `root` the end `b` of the final bracket `[b, c]` with the smaller
27
+ * value, once `|c − b| / 2 ≤ 2ε|b| + t`, so the root is within `4ε|b| + 2t` of
28
+ * it. A non-positive `t` is raised to the smallest subnormal, which still moves
29
+ * an iterate sitting at zero. Signs are compared, never multiplied, so values
30
+ * whose product would underflow or overflow keep their meaning; a non-finite
31
+ * interpolation fails Brent's acceptance test and bisects instead.
32
+ *
33
+ * Allocates nothing.
34
+ *
35
+ * @throws {ConvergenceError} After `maxIterations` evaluations, as `routine`.
36
+ */
37
+ export declare function brentKernel_(state: BrentState_, maxIterations: number, routine: string): void;
38
+ //# sourceMappingURL=_brent-kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_brent-kernel.d.ts","sourceRoot":"","sources":["../../src/roots/_brent-kernel.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,CAAC,EAAE,MAAM,CAAC;IACV,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,GACb,IAAI,CA+FN"}
@@ -0,0 +1,112 @@
1
+ import { ConvergenceError } from "../convergence-error.js";
2
+ /**
3
+ * Brent's `zero` (Algorithms for Minimization without Derivatives, 1973,
4
+ * chapter 4), over a bracket whose values are already known.
5
+ *
6
+ * Writes to `root` the end `b` of the final bracket `[b, c]` with the smaller
7
+ * value, once `|c − b| / 2 ≤ 2ε|b| + t`, so the root is within `4ε|b| + 2t` of
8
+ * it. A non-positive `t` is raised to the smallest subnormal, which still moves
9
+ * an iterate sitting at zero. Signs are compared, never multiplied, so values
10
+ * whose product would underflow or overflow keep their meaning; a non-finite
11
+ * interpolation fails Brent's acceptance test and bisects instead.
12
+ *
13
+ * Allocates nothing.
14
+ *
15
+ * @throws {ConvergenceError} After `maxIterations` evaluations, as `routine`.
16
+ */
17
+ export function brentKernel_(state, maxIterations, routine) {
18
+ let a = state.lower;
19
+ let b = state.upper;
20
+ let fa = state.lowerValue;
21
+ let fb = state.upperValue;
22
+ if (fa === 0) {
23
+ state.root = a;
24
+ return;
25
+ }
26
+ if (fb === 0) {
27
+ state.root = b;
28
+ return;
29
+ }
30
+ const absoluteTolerance = state.tolerance > 0 ? state.tolerance : Number.MIN_VALUE;
31
+ let c = a;
32
+ let fc = fa;
33
+ // Halves first: `b − a` overflows for a bracket spanning the whole range.
34
+ let d = 2 * (0.5 * b - 0.5 * a);
35
+ let e = d;
36
+ let iterations = 0;
37
+ for (;;) {
38
+ if ((fb > 0 && fc > 0) || (fb < 0 && fc < 0)) {
39
+ c = a;
40
+ fc = fa;
41
+ d = 2 * (0.5 * b - 0.5 * a);
42
+ e = d;
43
+ }
44
+ if (Math.abs(fc) < Math.abs(fb)) {
45
+ a = b;
46
+ b = c;
47
+ c = a;
48
+ fa = fb;
49
+ fb = fc;
50
+ fc = fa;
51
+ }
52
+ const step = 2 * Number.EPSILON * Math.abs(b) + absoluteTolerance;
53
+ const half = 0.5 * c - 0.5 * b;
54
+ if (Math.abs(half) <= step || fb === 0) {
55
+ state.root = b;
56
+ return;
57
+ }
58
+ if (Math.abs(e) < step || Math.abs(fa) <= Math.abs(fb)) {
59
+ d = half;
60
+ e = half;
61
+ }
62
+ else {
63
+ let s = fb / fa;
64
+ let p;
65
+ let q;
66
+ if (a === c) {
67
+ // Secant: only two distinct points so far.
68
+ p = 2 * half * s;
69
+ q = 1 - s;
70
+ }
71
+ else {
72
+ // Inverse quadratic interpolation through a, b and c.
73
+ const qa = fa / fc;
74
+ const r = fb / fc;
75
+ p = s * (2 * half * qa * (qa - r) - (b - a) * (r - 1));
76
+ q = (qa - 1) * (r - 1) * (s - 1);
77
+ }
78
+ if (p > 0) {
79
+ q = -q;
80
+ }
81
+ else {
82
+ p = -p;
83
+ }
84
+ s = e;
85
+ e = d;
86
+ if (2 * p < 3 * half * q - Math.abs(step * q) &&
87
+ p < Math.abs(0.5 * s * q)) {
88
+ d = p / q;
89
+ }
90
+ else {
91
+ d = half;
92
+ e = half;
93
+ }
94
+ }
95
+ a = b;
96
+ fa = fb;
97
+ if (Math.abs(d) > step) {
98
+ b += d;
99
+ }
100
+ else {
101
+ b += half > 0 ? step : -step;
102
+ }
103
+ if (iterations >= maxIterations) {
104
+ throw new ConvergenceError(routine, iterations);
105
+ }
106
+ iterations++;
107
+ state.x = b;
108
+ state.evaluate();
109
+ fb = state.value;
110
+ }
111
+ }
112
+ //# sourceMappingURL=_brent-kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_brent-kernel.js","sourceRoot":"","sources":["../../src/roots/_brent-kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAwB3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAC3B,KAAkB,EAClB,aAAqB,EACrB,OAAe;IAEf,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;IACpB,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;IACpB,IAAI,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC;IAC1B,IAAI,EAAE,GAAG,KAAK,CAA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7 @@
1
+ /** A copy of `array` at least `length` long, doubling to amortise growth. */
2
+ export declare function grownFloat64_(array: Float64Array, length: number): Float64Array<ArrayBuffer>;
3
+ /** {@link grownFloat64_} for an `Int8Array`. */
4
+ export declare function grownInt8_(array: Int8Array, length: number): Int8Array<ArrayBuffer>;
5
+ /** {@link grownFloat64_} for an `Int32Array`. */
6
+ export declare function grownInt32_(array: Int32Array, length: number): Int32Array<ArrayBuffer>;
7
+ //# sourceMappingURL=_grown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_grown.d.ts","sourceRoot":"","sources":["../../src/roots/_grown.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,wBAAgB,aAAa,CAC5B,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,GACZ,YAAY,CAAC,WAAW,CAAC,CAI3B;AAED,gDAAgD;AAChD,wBAAgB,UAAU,CACzB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,GACZ,SAAS,CAAC,WAAW,CAAC,CAIxB;AAED,iDAAiD;AACjD,wBAAgB,WAAW,CAC1B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,GACZ,UAAU,CAAC,WAAW,CAAC,CAIzB"}
@@ -0,0 +1,20 @@
1
+ // Generic, so bound for `@ac-kit/core`: math-analysis's TODO.md records it.
2
+ /** A copy of `array` at least `length` long, doubling to amortise growth. */
3
+ export function grownFloat64_(array, length) {
4
+ const grown = new Float64Array(Math.max(length, 2 * array.length));
5
+ grown.set(array);
6
+ return grown;
7
+ }
8
+ /** {@link grownFloat64_} for an `Int8Array`. */
9
+ export function grownInt8_(array, length) {
10
+ const grown = new Int8Array(Math.max(length, 2 * array.length));
11
+ grown.set(array);
12
+ return grown;
13
+ }
14
+ /** {@link grownFloat64_} for an `Int32Array`. */
15
+ export function grownInt32_(array, length) {
16
+ const grown = new Int32Array(Math.max(length, 2 * array.length));
17
+ grown.set(array);
18
+ return grown;
19
+ }
20
+ //# sourceMappingURL=_grown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_grown.js","sourceRoot":"","sources":["../../src/roots/_grown.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,6EAA6E;AAC7E,MAAM,UAAU,aAAa,CAC5B,KAAmB,EACnB,MAAc;IAEd,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACnE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACjB,OAAO,KAAK,CAAC;AACd,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,UAAU,CACzB,KAAgB,EAChB,MAAc;IAEd,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACjB,OAAO,KAAK,CAAC;AACd,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,WAAW,CAC1B,KAAiB,EACjB,MAAc;IAEd,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACjB,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { type Callable } from "@ac-kit/core";
2
+ import { type BrentState_ } from "./_brent-kernel.js";
3
+ import type { LevelSearchOptions } from "./level-search-options.js";
4
+ /** {@link LevelSearch_.setLevels}'s index for a `-∞` level: always below f. */
5
+ export declare const LEVEL_BELOW_ALL_ = -1;
6
+ /** {@link LevelSearch_.setLevels}'s index for a `+∞` level: always above f. */
7
+ export declare const LEVEL_ABOVE_ALL_ = -2;
8
+ /**
9
+ * The certified multi-level crossing search behind `findLevelCrossings` and
10
+ * `findLevelBands`, with every buffer it writes kept for the next run.
11
+ *
12
+ * One subdivision serves every level at once, so an expensive `f` is evaluated
13
+ * once per point however many levels are asked for. A node `[a, b]` with values
14
+ * `fa`, `fb` confines `f` to the Lipschitz envelope `[(fa + fb − L·w) / 2, (fa +
15
+ * fb + L·w) / 2]`; a level outside it is certified for the node. For a level
16
+ * inside it, the cones of slope `L` from both ends certify all but the core `[a +
17
+ * |fa − ℓ| / L, b − |fb − ℓ| / L]`. A node with a level left uncertain — a
18
+ * core, or a sign change — is bisected while it is at least `resolution` wide,
19
+ * and is otherwise a leaf, where a level with a sign change gets one crossing,
20
+ * enclosed by its core, and a level without one but with a core gets that core
21
+ * as unresolved.
22
+ *
23
+ * Cores less than `resolution` apart join, level by level: a run of them (a
24
+ * tangent leaves one) is one unresolved interval, and a run touching a crossing
25
+ * widens that crossing's enclosure instead — it can only hide a sub-resolution
26
+ * return of that crossing, so the odd cluster keeps one net crossing and states
27
+ * where all of it lies.
28
+ *
29
+ * Each child's cores are clipped to its parent's hull of cores, outside which
30
+ * the parent already certified every level, so a child never doubts what its
31
+ * parent settled. The split nodes at depth k are at most 2ᵏ, each `(upper −
32
+ * lower) / 2ᵏ` wide and at least `resolution` wide, which bounds the splits by
33
+ * `2 · (upper − lower) / resolution` (`4 ·` in integer mode, for rounding).
34
+ *
35
+ * Numbers move between the methods through fields and typed arrays, never as
36
+ * arguments or return values: a double crossing a call the engine does not
37
+ * inline is boxed, and a search must allocate nothing.
38
+ */
39
+ export declare class LevelSearch_ implements BrentState_ {
40
+ /** The finite levels, ascending and distinct. */
41
+ levels: Float64Array<ArrayBuffer>;
42
+ levelCount: number;
43
+ /** The interval to search, set before {@link run}. */
44
+ intervalLower: number;
45
+ intervalUpper: number;
46
+ /** Per level, `1` when `f(lower) ≥ level`, else `-1`. */
47
+ startSides: Int8Array<ArrayBuffer>;
48
+ crossingCount: number;
49
+ crossingTimes: Float64Array<ArrayBuffer>;
50
+ crossingEarliest: Float64Array<ArrayBuffer>;
51
+ crossingLatest: Float64Array<ArrayBuffer>;
52
+ crossingDirections: Int8Array<ArrayBuffer>;
53
+ crossingLevels: Int32Array<ArrayBuffer>;
54
+ unresolvedCount: number;
55
+ unresolvedStarts: Float64Array<ArrayBuffer>;
56
+ unresolvedEnds: Float64Array<ArrayBuffer>;
57
+ unresolvedLevels: Int32Array<ArrayBuffer>;
58
+ /** Calls to `f` made by the last run. */
59
+ evaluations: number;
60
+ lower: number;
61
+ upper: number;
62
+ lowerValue: number;
63
+ upperValue: number;
64
+ tolerance: number;
65
+ x: number;
66
+ value: number;
67
+ root: number;
68
+ private lastKinds_;
69
+ private lastIndices_;
70
+ private stack_;
71
+ private f_;
72
+ private budget_;
73
+ private signal_;
74
+ private routine_;
75
+ private maxRate_;
76
+ private resolution_;
77
+ private integer_;
78
+ private level_;
79
+ private oldSideAbove_;
80
+ private nodeA_;
81
+ private nodeB_;
82
+ private nodeFa_;
83
+ private nodeFb_;
84
+ private clipStart_;
85
+ private clipEnd_;
86
+ private margin_;
87
+ private first_;
88
+ private end_;
89
+ private middle_;
90
+ private hullStart_;
91
+ private hullEnd_;
92
+ private coreStart_;
93
+ private coreEnd_;
94
+ private readonly onOldSide_;
95
+ constructor();
96
+ /**
97
+ * Takes the distinct finite values among the first `count` of `values` as the
98
+ * levels, and writes to `indices` the level index of each value, or
99
+ * {@link LEVEL_BELOW_ALL_} / {@link LEVEL_ABOVE_ALL_} for `∓∞`.
100
+ */
101
+ setLevels(values: Float64Array, count: number, indices: Int32Array): void;
102
+ /** {@link BrentState_.evaluate}: `f(x) − level` into `value`. */
103
+ evaluate(): void;
104
+ /** Searches `[intervalLower, intervalUpper]` for the levels set. */
105
+ run(routine: string, f: Callable<[x: number], number>, options: LevelSearchOptions): void;
106
+ private search_;
107
+ /**
108
+ * Finds the node's candidate levels, `first_` to `end_`, and decides whether
109
+ * it is settled, split at `middle_` with the children clipped to
110
+ * `hullStart_`/`hullEnd_`, or a leaf.
111
+ */
112
+ private analyse_;
113
+ /**
114
+ * Classifies level `index` on the node and leaves its core, clipped to the
115
+ * parent's hull, in `coreStart_`/`coreEnd_` (empty when start > end).
116
+ */
117
+ private classify_;
118
+ /**
119
+ * Emits the leaf's crossings and unresolved cores. Every net crossing in a
120
+ * leaf goes the same way, from fa's side to fb's, so the levels are visited
121
+ * in the order f passes them.
122
+ */
123
+ private leaf_;
124
+ /** Refines the crossing of level `levelIndex` in the leaf, and emits it. */
125
+ private refine_;
126
+ /** The core of a same-side level joins its last crossing or unresolved run. */
127
+ private addUncertain_;
128
+ /**
129
+ * Drops the absorbed entries and sorts by start: entries come in leaf order,
130
+ * so only those of one leaf, for different levels, can be out of order.
131
+ */
132
+ private finishUnresolved_;
133
+ private reserve_;
134
+ /** `f(x)` into `value`, checked, counted and charged. */
135
+ private sample_;
136
+ }
137
+ //# sourceMappingURL=_level-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_level-search.d.ts","sourceRoot":"","sources":["../../src/roots/_level-search.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,QAAQ,EAIb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAyBnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,YAAa,YAAW,WAAW;IAC/C,iDAAiD;IACjD,MAAM,4BAAuB;IAC7B,UAAU,SAAK;IAEf,sDAAsD;IACtD,aAAa,SAAK;IAClB,aAAa,SAAK;IAElB,yDAAyD;IACzD,UAAU,yBAAoB;IAE9B,aAAa,SAAK;IAClB,aAAa,4BAAwB;IACrC,gBAAgB,4B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