parabolaDerivatives

Unqual!(typeof(X.init - Y.init))[3]
parabolaDerivatives
(
X
Y
)
(
in X x0
,
in X x1
,
in X x2
,
in Y y0
,
in Y y1
,
in Y y2
)

Return Value

Type: Unqual!(typeof(X.init - Y.init))[3]

[f'(x0), f'(x1), f'(x2)]

Examples

import mir.math.common: approxEqual;

alias f = (double x) => 3 * x ^^ 2 + 7 * x + 5;
auto x0 = 4;
auto x1 = 9;
auto x2 = 20;
auto p = parabolaKernel(x0, x1, x2, f(x0), f(x1), f(x2));

assert(p.a.approxEqual(3));
assert(p.b.approxEqual(7));
assert(p.c.approxEqual(5));
assert(p(10).approxEqual(f(10)));
import mir.math.common: approxEqual;

alias f = (double x) => 3 * x ^^ 2 + 7 * x + 5;
alias d = (double x) => 2 * 3 * x + 7;
auto x0 = 4;
auto x1 = 9;
auto p = ParabolaKernel!double.fromFirstDerivative(x0, x1, f(x0), f(x1), d(x1));

assert(p.a.approxEqual(3));
assert(p.b.approxEqual(7));
assert(p.c.approxEqual(5));

Meta