[f'(x0), f'(x1), f'(x2)]
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));