@ac-kit/math-analysis 0.2.0 → 0.3.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.
- package/CHANGELOG.md +89 -0
- package/README.md +85 -2
- package/dist/differentiation/finite-difference.d.ts +41 -0
- package/dist/differentiation/finite-difference.d.ts.map +1 -0
- package/dist/differentiation/finite-difference.js +53 -0
- package/dist/differentiation/finite-difference.js.map +1 -0
- package/dist/differentiation/gradient.d.ts +73 -0
- package/dist/differentiation/gradient.d.ts.map +1 -0
- package/dist/differentiation/gradient.js +167 -0
- package/dist/differentiation/gradient.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/interpolation/barycentric-interpolator.d.ts +29 -0
- package/dist/interpolation/barycentric-interpolator.d.ts.map +1 -0
- package/dist/interpolation/barycentric-interpolator.js +94 -0
- package/dist/interpolation/barycentric-interpolator.js.map +1 -0
- package/dist/legendre/_legendre-kernel.d.ts +22 -0
- package/dist/legendre/_legendre-kernel.d.ts.map +1 -0
- package/dist/legendre/_legendre-kernel.js +232 -0
- package/dist/legendre/_legendre-kernel.js.map +1 -0
- package/dist/legendre/legendre-fully-normalized.d.ts +52 -0
- package/dist/legendre/legendre-fully-normalized.d.ts.map +1 -0
- package/dist/legendre/legendre-fully-normalized.js +62 -0
- package/dist/legendre/legendre-fully-normalized.js.map +1 -0
- package/dist/legendre/legendre-index.d.ts +27 -0
- package/dist/legendre/legendre-index.d.ts.map +1 -0
- package/dist/legendre/legendre-index.js +31 -0
- package/dist/legendre/legendre-index.js.map +1 -0
- package/dist/legendre/legendre-schmidt.d.ts +37 -0
- package/dist/legendre/legendre-schmidt.d.ts.map +1 -0
- package/dist/legendre/legendre-schmidt.js +47 -0
- package/dist/legendre/legendre-schmidt.js.map +1 -0
- package/dist/ode/runge-kutta4.d.ts +46 -0
- package/dist/ode/runge-kutta4.d.ts.map +1 -0
- package/dist/ode/runge-kutta4.js +85 -0
- package/dist/ode/runge-kutta4.js.map +1 -0
- package/dist/optimize/_more-thuente.d.ts +95 -0
- package/dist/optimize/_more-thuente.d.ts.map +1 -0
- package/dist/optimize/_more-thuente.js +333 -0
- package/dist/optimize/_more-thuente.js.map +1 -0
- package/dist/optimize/_wolfe-line-search.d.ts +85 -0
- package/dist/optimize/_wolfe-line-search.d.ts.map +1 -0
- package/dist/optimize/_wolfe-line-search.js +193 -0
- package/dist/optimize/_wolfe-line-search.js.map +1 -0
- package/dist/optimize/bfgs.d.ts +262 -0
- package/dist/optimize/bfgs.d.ts.map +1 -0
- package/dist/optimize/bfgs.js +418 -0
- package/dist/optimize/bfgs.js.map +1 -0
- package/dist/optimize/lbfgs.d.ts +199 -0
- package/dist/optimize/lbfgs.d.ts.map +1 -0
- package/dist/optimize/lbfgs.js +383 -0
- package/dist/optimize/lbfgs.js.map +1 -0
- package/dist/optimize/levenberg-marquardt.d.ts +78 -0
- package/dist/optimize/levenberg-marquardt.d.ts.map +1 -0
- package/dist/optimize/levenberg-marquardt.js +204 -0
- package/dist/optimize/levenberg-marquardt.js.map +1 -0
- package/dist/optimize/nelder-mead.d.ts +68 -0
- package/dist/optimize/nelder-mead.d.ts.map +1 -0
- package/dist/optimize/nelder-mead.js +198 -0
- package/dist/optimize/nelder-mead.js.map +1 -0
- package/dist/quadrature/adaptive-quadrature.d.ts +53 -0
- package/dist/quadrature/adaptive-quadrature.d.ts.map +1 -0
- package/dist/quadrature/adaptive-quadrature.js +175 -0
- package/dist/quadrature/adaptive-quadrature.js.map +1 -0
- package/dist/quadrature/gauss-legendre.d.ts +27 -0
- package/dist/quadrature/gauss-legendre.d.ts.map +1 -0
- package/dist/quadrature/gauss-legendre.js +111 -0
- package/dist/quadrature/gauss-legendre.js.map +1 -0
- package/dist/quadrature/simpsons-rule.d.ts +27 -0
- package/dist/quadrature/simpsons-rule.d.ts.map +1 -0
- package/dist/quadrature/simpsons-rule.js +44 -0
- package/dist/quadrature/simpsons-rule.js.map +1 -0
- package/dist/roots/_grown.d.ts.map +1 -1
- package/dist/roots/_grown.js +0 -1
- package/dist/roots/_grown.js.map +1 -1
- package/dist/roots/_level-search.d.ts +19 -2
- package/dist/roots/_level-search.d.ts.map +1 -1
- package/dist/roots/_level-search.js +47 -23
- package/dist/roots/_level-search.js.map +1 -1
- package/dist/roots/find-level-bands.js +1 -1
- package/dist/roots/find-level-bands.js.map +1 -1
- package/dist/roots/find-level-crossings.d.ts +4 -2
- package/dist/roots/find-level-crossings.d.ts.map +1 -1
- package/dist/roots/find-level-crossings.js +4 -10
- package/dist/roots/find-level-crossings.js.map +1 -1
- package/dist/roots/newton-raphson.d.ts +31 -0
- package/dist/roots/newton-raphson.d.ts.map +1 -0
- package/dist/roots/newton-raphson.js +69 -0
- package/dist/roots/newton-raphson.js.map +1 -0
- package/dist/series/sum-series.d.ts +43 -0
- package/dist/series/sum-series.d.ts.map +1 -0
- package/dist/series/sum-series.js +70 -0
- package/dist/series/sum-series.js.map +1 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,94 @@
|
|
|
1
1
|
# @ac-kit/math-analysis
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c203e7: Minimisation by BFGS. Depends on `@ac-kit/math-linear` (its dense `Matrix`).
|
|
8
|
+
|
|
9
|
+
- `BfgsMinimizer(dimension, options)` minimises a smooth function of several
|
|
10
|
+
variables given as one objective `(point, gradient) => value` that writes
|
|
11
|
+
its gradient: BFGS quasi-Newton steps along `−H·∇f`, each line searched by
|
|
12
|
+
Moré and Thuente's algorithm (MINPACK-2 `dcsrch`) to the strong Wolfe
|
|
13
|
+
conditions (`sufficientDecrease`, `curvature`), with Hager and Zhang's
|
|
14
|
+
approximate Wolfe acceptance where `f` no longer resolves a decrease.
|
|
15
|
+
`minimize(out, objective, start, { initialInverseHessian, budget, signal })`
|
|
16
|
+
writes the point reached and leaves `value`, `gradient`, `inverseHessian`
|
|
17
|
+
(a `Matrix`), `iterations`, `evaluations`, `status` (`"gradient"`,
|
|
18
|
+
`"value"`, `"step"`, `"max-iterations"`, `"line-search"`) and `converged`;
|
|
19
|
+
it allocates nothing after the constructor. A non-finite trial value halves
|
|
20
|
+
the step (a domain boundary is never crossed); a non-descent direction or a
|
|
21
|
+
failed search resets to the steepest descent. `RangeError` for bad options,
|
|
22
|
+
lengths or a non-finite start; the signal's reason and the budget's error
|
|
23
|
+
(one unit per evaluation) propagate. O(n²) per step.
|
|
24
|
+
- `bfgs(objective, start, options)`: the one-shot form, returning a result
|
|
25
|
+
object.
|
|
26
|
+
- 5c203e7: - `gradient(out, f, point)`, `jacobian(out, f, point)` and
|
|
27
|
+
`hessian(out, f, point)`: multivariate derivatives by central differences
|
|
28
|
+
into a `Float64Array` or a `@ac-kit/math-linear` `Matrix`.
|
|
29
|
+
- `levenbergMarquardt(residuals, start, { residualCount, jacobian, … })`:
|
|
30
|
+
non-linear least squares by damped QR steps (Moré's scaling, Nielsen's
|
|
31
|
+
damping update), with a finite-difference Jacobian when none is given;
|
|
32
|
+
returns the point, residuals, cost, status and whether it converged.
|
|
33
|
+
- 5c203e7: Associated Legendre functions, with their colatitude derivatives, into a
|
|
34
|
+
caller's triangular `Float64Array` table:
|
|
35
|
+
`legendreSchmidt(out, maxDegree, colatitude, derivativesOut?)` writes the
|
|
36
|
+
Schmidt semi-normalised `Pₙᵐ(cos θ)` of geomagnetism (WMM, IGRF) and
|
|
37
|
+
`legendreFullyNormalized(out, maxDegree, colatitude, derivativesOut?)` the
|
|
38
|
+
fully normalised `P̄ₙₘ(cos θ)` of geodesy (EGM2008), both without the
|
|
39
|
+
Condon–Shortley phase, every degree and order up to `maxDegree`;
|
|
40
|
+
`legendreIndex(degree, order)` and `legendreTableLength(maxDegree)` address the
|
|
41
|
+
table. Finite and accurate at every colatitude to degree 2190 and beyond (to
|
|
42
|
+
2700; Holmes–Featherstone's modified forward column method), values below the
|
|
43
|
+
binary64 range underflowing rather than spoiling their column, derivatives
|
|
44
|
+
exact at the poles. O(maxDegree²), no allocation once the package's table of
|
|
45
|
+
integer roots has grown to the degree. `RangeError` for a degree that is not a
|
|
46
|
+
non-negative integer, a table that is too short, overlapping tables or a
|
|
47
|
+
colatitude outside `[0, π]`; `NaN` fills both tables.
|
|
48
|
+
- 5c203e7: - Quadrature: `simpsonsRule(f, lower, upper, intervals)`,
|
|
49
|
+
`gaussLegendre(f, lower, upper, nodes)` (exact to degree `2n − 1`, up to 1024
|
|
50
|
+
nodes) and `adaptiveQuadrature(f, lower, upper, options)` (adaptive
|
|
51
|
+
Gauss–Kronrod 7–15, returning the value, an error estimate, the evaluations
|
|
52
|
+
and whether the tolerances were met).
|
|
53
|
+
- `newtonRaphson(f, df, x0, options)`: throws a `RangeError` on a vanishing
|
|
54
|
+
derivative or divergence, a `ConvergenceError` when `maxIterations` runs out.
|
|
55
|
+
- `finiteDifference(f, x, { scheme, step })`: central, forward or backward,
|
|
56
|
+
the step rounded to representable points.
|
|
57
|
+
- `rungeKutta4(f, y0, tSpan, steps)`: classical RK4 over systems
|
|
58
|
+
(`OdeSystem`), returning the trajectory (`OdeTrajectory`).
|
|
59
|
+
- `createBarycentricInterpolator(xs, ys)`: polynomial interpolation in the
|
|
60
|
+
barycentric second form.
|
|
61
|
+
- `sumSeries(term, options)`: a series summed until its terms stop changing
|
|
62
|
+
it, with exactly rounded partial sums.
|
|
63
|
+
- `nelderMead(f, start, options)`: derivative-free minimisation with
|
|
64
|
+
Gao–Han adaptive coefficients.
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- 5c203e7: `findLevelCrossings` and `findLevelBands` with a reused `out` now allocate
|
|
69
|
+
nothing whatever their bounds: bounds that are not small integers, such as
|
|
70
|
+
epoch milliseconds, and the level of `findLevelCrossings` were boxed on every
|
|
71
|
+
search until its entry code reached the optimising tier, thousands of searches
|
|
72
|
+
in.
|
|
73
|
+
- Updated dependencies [5c203e7]
|
|
74
|
+
- Updated dependencies [5c203e7]
|
|
75
|
+
- Updated dependencies [5c203e7]
|
|
76
|
+
- Updated dependencies [5c203e7]
|
|
77
|
+
- Updated dependencies [5c203e7]
|
|
78
|
+
- Updated dependencies [5c203e7]
|
|
79
|
+
- Updated dependencies [5c203e7]
|
|
80
|
+
- Updated dependencies [5c203e7]
|
|
81
|
+
- Updated dependencies [5c203e7]
|
|
82
|
+
- Updated dependencies [5c203e7]
|
|
83
|
+
- Updated dependencies [5c203e7]
|
|
84
|
+
- Updated dependencies [5c203e7]
|
|
85
|
+
- Updated dependencies [5c203e7]
|
|
86
|
+
- Updated dependencies [5c203e7]
|
|
87
|
+
- @ac-kit/algo@0.7.0
|
|
88
|
+
- @ac-kit/core@0.14.0
|
|
89
|
+
- @ac-kit/math-linear@0.5.0
|
|
90
|
+
- @ac-kit/math-scalar@0.5.0
|
|
91
|
+
|
|
3
92
|
## 0.2.0
|
|
4
93
|
|
|
5
94
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,9 +6,12 @@ floating-point steps.
|
|
|
6
6
|
|
|
7
7
|
## Scope
|
|
8
8
|
|
|
9
|
-
Every function here takes a callable `f: (x: number) => number`
|
|
9
|
+
Every function here takes a callable `f: (x: number) => number` — or, for the
|
|
10
|
+
minimisers, `f: ℝⁿ → ℝ` with its gradient — and returns an
|
|
10
11
|
approximation with a stated error behaviour. That is the distinguishing trait:
|
|
11
|
-
the input is a _function_, not a value.
|
|
12
|
+
the input is a _function_, not a value. The special functions are the
|
|
13
|
+
exception that completes the rule: the functions of analysis themselves,
|
|
14
|
+
evaluated where a closed form or a recursion gives them.
|
|
12
15
|
|
|
13
16
|
Operations on values live in `@ac-kit/math-scalar`; operations on sampled
|
|
14
17
|
sequences live in `@ac-kit/math-signal`.
|
|
@@ -22,7 +25,19 @@ sequences live in `@ac-kit/math-signal`.
|
|
|
22
25
|
| `findLevelCrossings(f, lower, upper, options)` | Every crossing of a level, certified by a bound on `\|f′\|` | see below |
|
|
23
26
|
| `findLevelBands(f, lower, upper, bands, options)` | Where `low ≤ f < high`, for several bands at once, certified | see below |
|
|
24
27
|
| `trapezoidalRule(f, lower, upper, intervals)` | Definite integral by piecewise linear approximation | `O(h²)` |
|
|
28
|
+
| `simpsonsRule(f, lower, upper, intervals)` | Definite integral by piecewise parabolas | `O(h⁴)` |
|
|
29
|
+
| `gaussLegendre(f, lower, upper, nodes)` | Definite integral at the roots of `Pₙ`, exact to degree `2n − 1` | exponential for analytic `f` |
|
|
30
|
+
| `adaptiveQuadrature(f, lower, upper, options)` | Definite integral by adaptive Gauss–Kronrod 7–15 (QUADPACK `qag`), with an error estimate | to the tolerance |
|
|
31
|
+
| `newtonRaphson(f, df, x0, options)` | Root from a starting point and the derivative; throws on a vanishing derivative or divergence | quadratic |
|
|
32
|
+
| `finiteDifference(f, x, options)` | Derivative by a central, forward or backward difference, step rounded to representable points | `O(h²)` / `O(h)` |
|
|
33
|
+
| `rungeKutta4(f, y0, tSpan, steps)` | Trajectory of a system `y′ = f(t, y)`, classical RK4 | `O(h⁴)` |
|
|
34
|
+
| `createBarycentricInterpolator(xs, ys)` | The interpolating polynomial, barycentric second form | exact at the nodes |
|
|
35
|
+
| `sumSeries(term, options)` | Sum of a series, stopped when terms stop changing it, exactly rounded partial sums | to the tolerance |
|
|
36
|
+
| `nelderMead(f, start, options)` | Minimum without derivatives, Nelder–Mead with Gao–Han coefficients | heuristic |
|
|
37
|
+
| `gradient`, `jacobian`, `hessian` | Multivariate derivatives by central differences | `O(h²)` |
|
|
38
|
+
| `levenbergMarquardt(residuals, start, options)` | Non-linear least squares, damped QR steps with Moré scaling and Nielsen's damping update | quadratic near a zero residual |
|
|
25
39
|
| `continuedFractionEval(fraction, options)` | Value of a continued fraction, by modified Lentz | forward, no truncation guess |
|
|
40
|
+
| `BfgsMinimizer`, `bfgs(objective, start, options)` | Minimum of a smooth function of several variables, BFGS with a strong Wolfe line search | superlinear |
|
|
26
41
|
|
|
27
42
|
### Special functions
|
|
28
43
|
|
|
@@ -48,6 +63,35 @@ are not conveniences over `1 − P(a, x)` and `1 − erf(x)`: that subtraction h
|
|
|
48
63
|
already discarded the whole answer by the time it is worth asking for. `erf(10)`
|
|
49
64
|
is exactly `1` in binary64, while `erfc(10)` is `2.09e-45` and correct.
|
|
50
65
|
|
|
66
|
+
### Associated Legendre functions
|
|
67
|
+
|
|
68
|
+
| Symbol | Description |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `legendreSchmidt(out, maxDegree, colatitude, derivativesOut?)` | Schmidt semi-normalised `Pₙᵐ(cos θ)` and `dPₙᵐ/dθ`, every degree and order up to `maxDegree` — geomagnetism's (WMM, IGRF) |
|
|
71
|
+
| `legendreFullyNormalized(out, maxDegree, colatitude, derivativesOut?)` | Fully normalised `P̄ₙₘ(cos θ)` and `dP̄ₙₘ/dθ` — geodesy's (EGM2008, the geoid) |
|
|
72
|
+
| `legendreIndex(degree, order)`, `legendreTableLength(maxDegree)` | Where `(n, m)` sits in the triangular table, and its size |
|
|
73
|
+
|
|
74
|
+
Both fill a caller's `Float64Array` table, with no Condon–Shortley phase, in
|
|
75
|
+
O(maxDegree²) and with no allocation. Both run the Holmes–Featherstone modified
|
|
76
|
+
forward column method: each order's column is carried as `Pₙₘ / sinᵐθ` from a
|
|
77
|
+
scaled seed and multiplied back with the exponent of `sinᵐθ` kept apart, so the
|
|
78
|
+
table is finite and accurate at every colatitude to degree 2190 (EGM2008's)
|
|
79
|
+
and beyond, where the textbook recursion's seed `sinᵐθ` underflows to zero (past
|
|
80
|
+
order 180 at 1° from a pole) and takes every later degree of its column with
|
|
81
|
+
it. Near a pole the cosine is taken from the half angle, so a degree-2190
|
|
82
|
+
entry at `θ = 10⁻⁶` is not ruined by `cos θ` rounding. The derivatives come
|
|
83
|
+
from neighbouring orders, never through `1 / sin θ`, and are exact at the
|
|
84
|
+
poles.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { legendreIndex, legendreSchmidt, legendreTableLength } from "@ac-kit/math-analysis";
|
|
88
|
+
|
|
89
|
+
const values = new Float64Array(legendreTableLength(12));
|
|
90
|
+
const derivatives = new Float64Array(legendreTableLength(12));
|
|
91
|
+
legendreSchmidt(values, 12, colatitude, derivatives);
|
|
92
|
+
values[legendreIndex(3, 2)]; // P₃²(cos θ)
|
|
93
|
+
```
|
|
94
|
+
|
|
51
95
|
## Reliability over speed
|
|
52
96
|
|
|
53
97
|
Given a bracket where `f` changes sign, the intermediate value theorem
|
|
@@ -128,6 +172,45 @@ V8, a double crossing a call the engine does not inline is boxed by its caller:
|
|
|
128
172
|
`f`'s result, unless `f` is inlined, and the arguments of a call site that has
|
|
129
173
|
seen many shapes of `f` or of the options object are the caller's allocations.
|
|
130
174
|
|
|
175
|
+
## Minimisation
|
|
176
|
+
|
|
177
|
+
`BfgsMinimizer` minimises a smooth `f: ℝⁿ → ℝ` given with its gradient — the
|
|
178
|
+
objective writes `∇f` into an array and returns `f` — by the BFGS
|
|
179
|
+
quasi-Newton method: SciPy's `minimize(method="BFGS")` and Optim.jl's `BFGS`,
|
|
180
|
+
for up to a few hundred variables. Each step searches its line with Moré and
|
|
181
|
+
Thuente's algorithm (MINPACK-2's `dcsrch`, step for step) until the strong
|
|
182
|
+
Wolfe conditions hold, which keeps the inverse Hessian approximation positive
|
|
183
|
+
definite; near the minimum, where `f` can no longer resolve a decrease, Hager
|
|
184
|
+
and Zhang's approximate Wolfe conditions let the gradient converge past the
|
|
185
|
+
precision of `f`. A trial point where `f` is not finite halves the step, so a
|
|
186
|
+
domain boundary is approached and never crossed.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { BfgsMinimizer } from "@ac-kit/math-analysis";
|
|
190
|
+
|
|
191
|
+
const minimizer = new BfgsMinimizer(2, { gradientTolerance: 1e-10 });
|
|
192
|
+
const point = minimizer.minimize(
|
|
193
|
+
new Float64Array(2),
|
|
194
|
+
(x, gradient) => {
|
|
195
|
+
const a = 1 - x[0]!;
|
|
196
|
+
const b = x[1]! - x[0]! * x[0]!;
|
|
197
|
+
gradient[0] = -2 * a - 400 * x[0]! * b;
|
|
198
|
+
gradient[1] = 200 * b;
|
|
199
|
+
return a * a + 100 * b * b;
|
|
200
|
+
},
|
|
201
|
+
Float64Array.of(-1.2, 1),
|
|
202
|
+
);
|
|
203
|
+
minimizer.status; // "gradient": converged; also "value", "step",
|
|
204
|
+
// "max-iterations" or "line-search"
|
|
205
|
+
minimizer.inverseHessian; // a Matrix (@ac-kit/math-linear), ≈ (∇²f)⁻¹
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
A minimiser is made once per dimension and options and allocates nothing
|
|
209
|
+
afterwards; `bfgs(objective, start, options)` is the one-shot form. A
|
|
210
|
+
`WorkBudget` is charged one unit per evaluation and an `AbortSignal` checked
|
|
211
|
+
before each. The variables are unconstrained: reparametrise a bounded one
|
|
212
|
+
(`σ = eᵗ` for a scale).
|
|
213
|
+
|
|
131
214
|
## Usage
|
|
132
215
|
|
|
133
216
|
```ts
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Which side of `x` a finite difference samples. */
|
|
2
|
+
export type FiniteDifferenceScheme = "central" | "forward" | "backward";
|
|
3
|
+
/** The options of {@link finiteDifference}. */
|
|
4
|
+
export type FiniteDifferenceOptions = {
|
|
5
|
+
/** `"central"` (the default, `O(h²)`), `"forward"` or `"backward"` (`O(h)`). */
|
|
6
|
+
scheme?: FiniteDifferenceScheme;
|
|
7
|
+
/**
|
|
8
|
+
* The step. By default the one that balances truncation against rounding for
|
|
9
|
+
* a function computed to full precision: `∛ε · max(|x|, 1)` for the central
|
|
10
|
+
* scheme, `√ε · max(|x|, 1)` for the one-sided ones.
|
|
11
|
+
*/
|
|
12
|
+
step?: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The derivative of `f` at `x` by a finite difference: `(f(x + h) − f(x − h)) /
|
|
16
|
+
* 2h` for the central scheme, `(f(x + h) − f(x)) / h` forward and `(f(x) − f(x
|
|
17
|
+
* − h)) / h` backward.
|
|
18
|
+
*
|
|
19
|
+
* The step is rounded so that `x + h` and `x − h` are exactly representable and
|
|
20
|
+
* differ from `x` by exactly the `h` divided by — without that, the rounding of
|
|
21
|
+
* `x + h` alone is an error of up to half an ulp of `x` in the denominator.
|
|
22
|
+
* With the default step, a central difference keeps about two thirds of the
|
|
23
|
+
* significant digits (around 1e-11 relative for a well-scaled smooth function)
|
|
24
|
+
* and a one-sided one about half. Use a one-sided scheme only where `f` is not
|
|
25
|
+
* defined on one side of `x`. Two or three calls to `f`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* finiteDifference(Math.sin, 0); // ≈ 1, within 1e-10
|
|
30
|
+
* finiteDifference(Math.sqrt, 0, { scheme: "forward", step: 1e-8 }); // 1e4 — √x has no derivative at 0
|
|
31
|
+
* ```;
|
|
32
|
+
*
|
|
33
|
+
* @param f The function to differentiate.
|
|
34
|
+
* @param x Where to take the derivative.
|
|
35
|
+
* @param options The scheme and the step.
|
|
36
|
+
* @returns The estimated derivative.
|
|
37
|
+
* @throws {RangeError} When the step is not positive and finite, or the scheme
|
|
38
|
+
* is unknown.
|
|
39
|
+
*/
|
|
40
|
+
export declare function finiteDifference(f: (x: number) => number, x: number, options?: FiniteDifferenceOptions): number;
|
|
41
|
+
//# sourceMappingURL=finite-difference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finite-difference.d.ts","sourceRoot":"","sources":["../../src/differentiation/finite-difference.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAExE,+CAA+C;AAC/C,MAAM,MAAM,uBAAuB,GAAG;IACrC,gFAAgF;IAChF,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAC/B,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EACxB,CAAC,EAAE,MAAM,EACT,OAAO,CAAC,EAAE,uBAAuB,GAC/B,MAAM,CA2BR"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describeValue } from "@ac-kit/core";
|
|
2
|
+
const CUBE_ROOT_EPSILON_ = Math.cbrt(Number.EPSILON);
|
|
3
|
+
const SQUARE_ROOT_EPSILON_ = Math.sqrt(Number.EPSILON);
|
|
4
|
+
/**
|
|
5
|
+
* The derivative of `f` at `x` by a finite difference: `(f(x + h) − f(x − h)) /
|
|
6
|
+
* 2h` for the central scheme, `(f(x + h) − f(x)) / h` forward and `(f(x) − f(x
|
|
7
|
+
* − h)) / h` backward.
|
|
8
|
+
*
|
|
9
|
+
* The step is rounded so that `x + h` and `x − h` are exactly representable and
|
|
10
|
+
* differ from `x` by exactly the `h` divided by — without that, the rounding of
|
|
11
|
+
* `x + h` alone is an error of up to half an ulp of `x` in the denominator.
|
|
12
|
+
* With the default step, a central difference keeps about two thirds of the
|
|
13
|
+
* significant digits (around 1e-11 relative for a well-scaled smooth function)
|
|
14
|
+
* and a one-sided one about half. Use a one-sided scheme only where `f` is not
|
|
15
|
+
* defined on one side of `x`. Two or three calls to `f`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* finiteDifference(Math.sin, 0); // ≈ 1, within 1e-10
|
|
20
|
+
* finiteDifference(Math.sqrt, 0, { scheme: "forward", step: 1e-8 }); // 1e4 — √x has no derivative at 0
|
|
21
|
+
* ```;
|
|
22
|
+
*
|
|
23
|
+
* @param f The function to differentiate.
|
|
24
|
+
* @param x Where to take the derivative.
|
|
25
|
+
* @param options The scheme and the step.
|
|
26
|
+
* @returns The estimated derivative.
|
|
27
|
+
* @throws {RangeError} When the step is not positive and finite, or the scheme
|
|
28
|
+
* is unknown.
|
|
29
|
+
*/
|
|
30
|
+
export function finiteDifference(f, x, options) {
|
|
31
|
+
const scheme = options?.scheme ?? "central";
|
|
32
|
+
if (scheme !== "central" && scheme !== "forward" && scheme !== "backward") {
|
|
33
|
+
throw new RangeError(`finiteDifference: unknown scheme ${describeValue(scheme)}`);
|
|
34
|
+
}
|
|
35
|
+
const scale = Math.max(Math.abs(x), 1);
|
|
36
|
+
const requested = options?.step ??
|
|
37
|
+
(scheme === "central" ? CUBE_ROOT_EPSILON_ : SQUARE_ROOT_EPSILON_) * scale;
|
|
38
|
+
if (!(requested > 0) || requested === Infinity) {
|
|
39
|
+
throw new RangeError(`finiteDifference: step must be positive and finite, got ${describeValue(requested)}`);
|
|
40
|
+
}
|
|
41
|
+
// The step actually taken: the difference of two representable points.
|
|
42
|
+
const above = x + requested;
|
|
43
|
+
const step = above - x;
|
|
44
|
+
if (scheme === "forward") {
|
|
45
|
+
return (f(above) - f(x)) / step;
|
|
46
|
+
}
|
|
47
|
+
const below = x - step;
|
|
48
|
+
if (scheme === "backward") {
|
|
49
|
+
return (f(x) - f(below)) / (x - below);
|
|
50
|
+
}
|
|
51
|
+
return (f(above) - f(below)) / (above - below);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=finite-difference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finite-difference.js","sourceRoot":"","sources":["../../src/differentiation/finite-difference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiB7C,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gBAAgB,CAC/B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AAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Matrix } from "@ac-kit/math-linear";
|
|
2
|
+
/** The options of {@link gradient}, {@link jacobian} and {@link hessian}. */
|
|
3
|
+
export type DerivativeStepOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* The step per coordinate, relative to `max(|xᵢ|, 1)`. By default the one
|
|
6
|
+
* that balances truncation against rounding: `∛ε` for the central first
|
|
7
|
+
* differences of `gradient` and `jacobian`, `⁴√ε` for the second differences
|
|
8
|
+
* of `hessian`.
|
|
9
|
+
*/
|
|
10
|
+
relativeStep?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The gradient `∇f` of a scalar function of several variables at `point`, by
|
|
14
|
+
* central differences: `∂f/∂xᵢ ≈ (f(x + hᵢeᵢ) − f(x − hᵢeᵢ)) / 2hᵢ`, each step
|
|
15
|
+
* rounded so that both shifted coordinates are representable and exactly `2hᵢ`
|
|
16
|
+
* apart. `2n` calls to `f`, which receives one scratch vector it must not keep.
|
|
17
|
+
* What lets {@link bfgs} minimise a function given without its gradient.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* gradient(new Float64Array(2), (x) => x[0]! ** 2 + 3 * x[1]!, [1, 5]); // ≈ [2, 3]
|
|
22
|
+
* ```;
|
|
23
|
+
*
|
|
24
|
+
* @param out The gradient, one entry per coordinate.
|
|
25
|
+
* @param f The function.
|
|
26
|
+
* @param point Where to differentiate.
|
|
27
|
+
* @param options The relative step.
|
|
28
|
+
* @returns `out`.
|
|
29
|
+
* @throws {RangeError} When `out` has another length than `point`, a coordinate
|
|
30
|
+
* is not finite, or the step is not positive.
|
|
31
|
+
*/
|
|
32
|
+
export declare function gradient(out: Float64Array, f: (x: Float64Array) => number, point: ArrayLike<number>, options?: DerivativeStepOptions): Float64Array;
|
|
33
|
+
/**
|
|
34
|
+
* The Jacobian of a vector function `F: ℝⁿ → ℝᵐ` at `point`, by central
|
|
35
|
+
* differences, into the `m × n` matrix `out`: column `j` is `(F(x + hⱼeⱼ) − F(x
|
|
36
|
+
* − hⱼeⱼ)) / 2hⱼ`. `F` writes its `m` values into the array it is given; `2n`
|
|
37
|
+
* calls, two scratch value arrays.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* // F(x, y) = (x·y, x + y²)
|
|
42
|
+
* const out = matrixCreate(2, 2);
|
|
43
|
+
* jacobian(out, (values, x) => { values[0] = x[0]! * x[1]!; values[1] = x[0]! + x[1]! ** 2; }, [2, 3]);
|
|
44
|
+
* // ≈ [[3, 2], [1, 6]]
|
|
45
|
+
* ```;
|
|
46
|
+
*
|
|
47
|
+
* @param out The Jacobian, `m × n`, column-major.
|
|
48
|
+
* @param f The function; writes `out.rows` values.
|
|
49
|
+
* @param point Where to differentiate, `out.columns` coordinates.
|
|
50
|
+
* @param options The relative step.
|
|
51
|
+
* @returns `out`.
|
|
52
|
+
* @throws {RangeError} When the shapes disagree, a coordinate is not finite, or
|
|
53
|
+
* the step is not positive.
|
|
54
|
+
*/
|
|
55
|
+
export declare function jacobian(out: Matrix, f: (values: Float64Array, x: Float64Array) => void, point: ArrayLike<number>, options?: DerivativeStepOptions): Matrix;
|
|
56
|
+
/**
|
|
57
|
+
* The Hessian of a scalar function at `point`, by central second differences,
|
|
58
|
+
* into the symmetric `n × n` matrix `out`: `(f(x + hᵢ) − 2f(x) + f(x − hᵢ)) /
|
|
59
|
+
* hᵢ²` on the diagonal, `(f(x + hᵢ + hⱼ) − f(x + hᵢ − hⱼ) − f(x − hᵢ + hⱼ) +
|
|
60
|
+
* f(x − hᵢ − hⱼ)) / 4hᵢhⱼ` off it, written to both halves. `2n² + 1` calls to
|
|
61
|
+
* `f`; about a third of the digits of `f` survive, so prefer an analytic
|
|
62
|
+
* Hessian where one exists.
|
|
63
|
+
*
|
|
64
|
+
* @param out The Hessian, `n × n`.
|
|
65
|
+
* @param f The function.
|
|
66
|
+
* @param point Where to differentiate, `n` coordinates.
|
|
67
|
+
* @param options The relative step.
|
|
68
|
+
* @returns `out`.
|
|
69
|
+
* @throws {RangeError} When `out` is not `n × n`, a coordinate is not finite,
|
|
70
|
+
* or the step is not positive.
|
|
71
|
+
*/
|
|
72
|
+
export declare function hessian(out: Matrix, f: (x: Float64Array) => number, point: ArrayLike<number>, options?: DerivativeStepOptions): Matrix;
|
|
73
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/differentiation/gradient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,6EAA6E;AAC7E,MAAM,MAAM,qBAAqB,GAAG;IACnC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAgCF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,YAAY,EACjB,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,MAAM,EAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,EACxB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,YAAY,CAoBd;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,MAAM,EACX,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,KAAK,IAAI,EAClD,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,EACxB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,MAAM,CA0BR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CACtB,GAAG,EAAE,MAAM,EACX,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,MAAM,EAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,EACxB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,MAAM,CA8CR"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { describeValue } from "@ac-kit/core";
|
|
2
|
+
const CUBE_ROOT_EPSILON_ = Math.cbrt(Number.EPSILON);
|
|
3
|
+
const FOURTH_ROOT_EPSILON_ = Math.sqrt(Math.sqrt(Number.EPSILON));
|
|
4
|
+
function checkPoint_(name, point) {
|
|
5
|
+
const copy = Float64Array.from(point);
|
|
6
|
+
for (let index = 0; index < copy.length; index++) {
|
|
7
|
+
const value = copy[index];
|
|
8
|
+
if (value - value !== 0) {
|
|
9
|
+
throw new RangeError(`${name}: coordinate ${index} is ${describeValue(value)}, not finite`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return copy;
|
|
13
|
+
}
|
|
14
|
+
function relativeStep_(name, options, fallback) {
|
|
15
|
+
const step = options?.relativeStep ?? fallback;
|
|
16
|
+
if (!(step > 0) || step === Infinity) {
|
|
17
|
+
throw new RangeError(`${name}: relativeStep must be positive and finite, got ${describeValue(step)}`);
|
|
18
|
+
}
|
|
19
|
+
return step;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The gradient `∇f` of a scalar function of several variables at `point`, by
|
|
23
|
+
* central differences: `∂f/∂xᵢ ≈ (f(x + hᵢeᵢ) − f(x − hᵢeᵢ)) / 2hᵢ`, each step
|
|
24
|
+
* rounded so that both shifted coordinates are representable and exactly `2hᵢ`
|
|
25
|
+
* apart. `2n` calls to `f`, which receives one scratch vector it must not keep.
|
|
26
|
+
* What lets {@link bfgs} minimise a function given without its gradient.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* gradient(new Float64Array(2), (x) => x[0]! ** 2 + 3 * x[1]!, [1, 5]); // ≈ [2, 3]
|
|
31
|
+
* ```;
|
|
32
|
+
*
|
|
33
|
+
* @param out The gradient, one entry per coordinate.
|
|
34
|
+
* @param f The function.
|
|
35
|
+
* @param point Where to differentiate.
|
|
36
|
+
* @param options The relative step.
|
|
37
|
+
* @returns `out`.
|
|
38
|
+
* @throws {RangeError} When `out` has another length than `point`, a coordinate
|
|
39
|
+
* is not finite, or the step is not positive.
|
|
40
|
+
*/
|
|
41
|
+
export function gradient(out, f, point, options) {
|
|
42
|
+
const x = checkPoint_("gradient", point);
|
|
43
|
+
if (out.length !== x.length) {
|
|
44
|
+
throw new RangeError(`gradient: out holds ${out.length} entries for ${x.length} coordinates`);
|
|
45
|
+
}
|
|
46
|
+
const relative = relativeStep_("gradient", options, CUBE_ROOT_EPSILON_);
|
|
47
|
+
for (let index = 0; index < x.length; index++) {
|
|
48
|
+
const centre = x[index];
|
|
49
|
+
const above = centre + relative * Math.max(Math.abs(centre), 1);
|
|
50
|
+
const below = centre - (above - centre);
|
|
51
|
+
x[index] = above;
|
|
52
|
+
const upper = f(x);
|
|
53
|
+
x[index] = below;
|
|
54
|
+
const lower = f(x);
|
|
55
|
+
x[index] = centre;
|
|
56
|
+
out[index] = (upper - lower) / (above - below);
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The Jacobian of a vector function `F: ℝⁿ → ℝᵐ` at `point`, by central
|
|
62
|
+
* differences, into the `m × n` matrix `out`: column `j` is `(F(x + hⱼeⱼ) − F(x
|
|
63
|
+
* − hⱼeⱼ)) / 2hⱼ`. `F` writes its `m` values into the array it is given; `2n`
|
|
64
|
+
* calls, two scratch value arrays.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* // F(x, y) = (x·y, x + y²)
|
|
69
|
+
* const out = matrixCreate(2, 2);
|
|
70
|
+
* jacobian(out, (values, x) => { values[0] = x[0]! * x[1]!; values[1] = x[0]! + x[1]! ** 2; }, [2, 3]);
|
|
71
|
+
* // ≈ [[3, 2], [1, 6]]
|
|
72
|
+
* ```;
|
|
73
|
+
*
|
|
74
|
+
* @param out The Jacobian, `m × n`, column-major.
|
|
75
|
+
* @param f The function; writes `out.rows` values.
|
|
76
|
+
* @param point Where to differentiate, `out.columns` coordinates.
|
|
77
|
+
* @param options The relative step.
|
|
78
|
+
* @returns `out`.
|
|
79
|
+
* @throws {RangeError} When the shapes disagree, a coordinate is not finite, or
|
|
80
|
+
* the step is not positive.
|
|
81
|
+
*/
|
|
82
|
+
export function jacobian(out, f, point, options) {
|
|
83
|
+
const x = checkPoint_("jacobian", point);
|
|
84
|
+
const { rows, columns, data } = out;
|
|
85
|
+
if (columns !== x.length || data.length !== rows * columns) {
|
|
86
|
+
throw new RangeError(`jacobian: a ${rows} × ${columns} matrix for ${x.length} coordinates`);
|
|
87
|
+
}
|
|
88
|
+
const relative = relativeStep_("jacobian", options, CUBE_ROOT_EPSILON_);
|
|
89
|
+
const upper = new Float64Array(rows);
|
|
90
|
+
const lower = new Float64Array(rows);
|
|
91
|
+
for (let column = 0; column < columns; column++) {
|
|
92
|
+
const centre = x[column];
|
|
93
|
+
const above = centre + relative * Math.max(Math.abs(centre), 1);
|
|
94
|
+
const below = centre - (above - centre);
|
|
95
|
+
x[column] = above;
|
|
96
|
+
f(upper, x);
|
|
97
|
+
x[column] = below;
|
|
98
|
+
f(lower, x);
|
|
99
|
+
x[column] = centre;
|
|
100
|
+
const width = above - below;
|
|
101
|
+
for (let row = 0; row < rows; row++) {
|
|
102
|
+
data[column * rows + row] = (upper[row] - lower[row]) / width;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The Hessian of a scalar function at `point`, by central second differences,
|
|
109
|
+
* into the symmetric `n × n` matrix `out`: `(f(x + hᵢ) − 2f(x) + f(x − hᵢ)) /
|
|
110
|
+
* hᵢ²` on the diagonal, `(f(x + hᵢ + hⱼ) − f(x + hᵢ − hⱼ) − f(x − hᵢ + hⱼ) +
|
|
111
|
+
* f(x − hᵢ − hⱼ)) / 4hᵢhⱼ` off it, written to both halves. `2n² + 1` calls to
|
|
112
|
+
* `f`; about a third of the digits of `f` survive, so prefer an analytic
|
|
113
|
+
* Hessian where one exists.
|
|
114
|
+
*
|
|
115
|
+
* @param out The Hessian, `n × n`.
|
|
116
|
+
* @param f The function.
|
|
117
|
+
* @param point Where to differentiate, `n` coordinates.
|
|
118
|
+
* @param options The relative step.
|
|
119
|
+
* @returns `out`.
|
|
120
|
+
* @throws {RangeError} When `out` is not `n × n`, a coordinate is not finite,
|
|
121
|
+
* or the step is not positive.
|
|
122
|
+
*/
|
|
123
|
+
export function hessian(out, f, point, options) {
|
|
124
|
+
const x = checkPoint_("hessian", point);
|
|
125
|
+
const n = x.length;
|
|
126
|
+
const { rows, columns, data } = out;
|
|
127
|
+
if (rows !== n || columns !== n || data.length !== n * n) {
|
|
128
|
+
throw new RangeError(`hessian: a ${rows} × ${columns} matrix for ${n} coordinates`);
|
|
129
|
+
}
|
|
130
|
+
const relative = relativeStep_("hessian", options, FOURTH_ROOT_EPSILON_);
|
|
131
|
+
const steps = new Float64Array(n);
|
|
132
|
+
for (let index = 0; index < n; index++) {
|
|
133
|
+
const centre = x[index];
|
|
134
|
+
steps[index] = centre + relative * Math.max(Math.abs(centre), 1) - centre;
|
|
135
|
+
}
|
|
136
|
+
const value = f(x);
|
|
137
|
+
for (let i = 0; i < n; i++) {
|
|
138
|
+
const xi = x[i];
|
|
139
|
+
const hi = steps[i];
|
|
140
|
+
x[i] = xi + hi;
|
|
141
|
+
const plus = f(x);
|
|
142
|
+
x[i] = xi - hi;
|
|
143
|
+
const minus = f(x);
|
|
144
|
+
x[i] = xi;
|
|
145
|
+
data[i * n + i] = (plus - 2 * value + minus) / (hi * hi);
|
|
146
|
+
for (let j = i + 1; j < n; j++) {
|
|
147
|
+
const xj = x[j];
|
|
148
|
+
const hj = steps[j];
|
|
149
|
+
x[i] = xi + hi;
|
|
150
|
+
x[j] = xj + hj;
|
|
151
|
+
const plusPlus = f(x);
|
|
152
|
+
x[j] = xj - hj;
|
|
153
|
+
const plusMinus = f(x);
|
|
154
|
+
x[i] = xi - hi;
|
|
155
|
+
const minusMinus = f(x);
|
|
156
|
+
x[j] = xj + hj;
|
|
157
|
+
const minusPlus = f(x);
|
|
158
|
+
x[i] = xi;
|
|
159
|
+
x[j] = xj;
|
|
160
|
+
const mixed = (plusPlus - plusMinus - minusPlus + minusMinus) / (4 * hi * hj);
|
|
161
|
+
data[j * n + i] = mixed;
|
|
162
|
+
data[i * n + j] = mixed;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return out;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=gradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.js","sourceRoot":"","sources":["../../src/differentiation/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAc7C,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAElE,SAAS,WAAW,CAAC,IAAY,EAAE,KAAwB;IAC1D,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC;QAC3B,IAAI,KAAK,GAAG,KAAK,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,UAAU,CACnB,GAAG,IAAI,gBAAgB,KAAK,OAAO,aAAa,CAAC,KAAK,CAAC,cAAc,CACrE,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,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;YACjB,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;YACrB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACf,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACf,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACf,MAAM,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACf,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YACV,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YACV,MAAM,KAAK,GACV,CAAC,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;YACjE,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;IACF,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,27 @@ export * from "./continued-fraction-eval.js";
|
|
|
4
4
|
export * from "./convergence-error.js";
|
|
5
5
|
export * from "./convergence-options.js";
|
|
6
6
|
export * from "./convergence-result.js";
|
|
7
|
+
export * from "./differentiation/finite-difference.js";
|
|
8
|
+
export * from "./differentiation/gradient.js";
|
|
7
9
|
export * from "./erf.js";
|
|
8
10
|
export * from "./erfc.js";
|
|
9
11
|
export * from "./gamma.js";
|
|
12
|
+
export * from "./interpolation/barycentric-interpolator.js";
|
|
10
13
|
export * from "./inverse-regularized-incomplete-beta.js";
|
|
11
14
|
export * from "./inverse-regularized-incomplete-gamma.js";
|
|
15
|
+
export * from "./legendre/legendre-fully-normalized.js";
|
|
16
|
+
export * from "./legendre/legendre-index.js";
|
|
17
|
+
export * from "./legendre/legendre-schmidt.js";
|
|
12
18
|
export * from "./log-beta.js";
|
|
13
19
|
export * from "./log-gamma.js";
|
|
20
|
+
export * from "./ode/runge-kutta4.js";
|
|
21
|
+
export * from "./optimize/bfgs.js";
|
|
22
|
+
export * from "./optimize/lbfgs.js";
|
|
23
|
+
export * from "./optimize/levenberg-marquardt.js";
|
|
24
|
+
export * from "./optimize/nelder-mead.js";
|
|
25
|
+
export * from "./quadrature/adaptive-quadrature.js";
|
|
26
|
+
export * from "./quadrature/gauss-legendre.js";
|
|
27
|
+
export * from "./quadrature/simpsons-rule.js";
|
|
14
28
|
export * from "./regularized-incomplete-beta.js";
|
|
15
29
|
export * from "./regularized-incomplete-gamma-upper.js";
|
|
16
30
|
export * from "./regularized-incomplete-gamma.js";
|
|
@@ -18,5 +32,7 @@ export * from "./roots/brent.js";
|
|
|
18
32
|
export * from "./roots/find-level-bands.js";
|
|
19
33
|
export * from "./roots/find-level-crossings.js";
|
|
20
34
|
export * from "./roots/level-search-options.js";
|
|
35
|
+
export * from "./roots/newton-raphson.js";
|
|
36
|
+
export * from "./series/sum-series.js";
|
|
21
37
|
export * from "./trapezoidal-rule.js";
|
|
22
38
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,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,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,27 @@ export * from "./continued-fraction-eval.js";
|
|
|
4
4
|
export * from "./convergence-error.js";
|
|
5
5
|
export * from "./convergence-options.js";
|
|
6
6
|
export * from "./convergence-result.js";
|
|
7
|
+
export * from "./differentiation/finite-difference.js";
|
|
8
|
+
export * from "./differentiation/gradient.js";
|
|
7
9
|
export * from "./erf.js";
|
|
8
10
|
export * from "./erfc.js";
|
|
9
11
|
export * from "./gamma.js";
|
|
12
|
+
export * from "./interpolation/barycentric-interpolator.js";
|
|
10
13
|
export * from "./inverse-regularized-incomplete-beta.js";
|
|
11
14
|
export * from "./inverse-regularized-incomplete-gamma.js";
|
|
15
|
+
export * from "./legendre/legendre-fully-normalized.js";
|
|
16
|
+
export * from "./legendre/legendre-index.js";
|
|
17
|
+
export * from "./legendre/legendre-schmidt.js";
|
|
12
18
|
export * from "./log-beta.js";
|
|
13
19
|
export * from "./log-gamma.js";
|
|
20
|
+
export * from "./ode/runge-kutta4.js";
|
|
21
|
+
export * from "./optimize/bfgs.js";
|
|
22
|
+
export * from "./optimize/lbfgs.js";
|
|
23
|
+
export * from "./optimize/levenberg-marquardt.js";
|
|
24
|
+
export * from "./optimize/nelder-mead.js";
|
|
25
|
+
export * from "./quadrature/adaptive-quadrature.js";
|
|
26
|
+
export * from "./quadrature/gauss-legendre.js";
|
|
27
|
+
export * from "./quadrature/simpsons-rule.js";
|
|
14
28
|
export * from "./regularized-incomplete-beta.js";
|
|
15
29
|
export * from "./regularized-incomplete-gamma-upper.js";
|
|
16
30
|
export * from "./regularized-incomplete-gamma.js";
|
|
@@ -18,5 +32,7 @@ export * from "./roots/brent.js";
|
|
|
18
32
|
export * from "./roots/find-level-bands.js";
|
|
19
33
|
export * from "./roots/find-level-crossings.js";
|
|
20
34
|
export * from "./roots/level-search-options.js";
|
|
35
|
+
export * from "./roots/newton-raphson.js";
|
|
36
|
+
export * from "./series/sum-series.js";
|
|
21
37
|
export * from "./trapezoidal-rule.js";
|
|
22
38
|
//# sourceMappingURL=index.js.map
|