Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
mir.interpolate.utility
- struct
ParabolaKernel(T);
ParabolaKernel!(Unqual!(typeof(X.init - Y.init)))parabolaKernel(X, Y)(in Xx0, in Xx1, in Xx2, in Yy0, in Yy1, in Yy2); - Quadratic function structure
- T
a; - T
b; - T
c; - this(T
a, Tb, Tc); - this(T
x0, Tx1, Tx2, Ty0, Ty1, Ty2); - Builds parabola given three points
- static ParabolaKernel
fromFirstDerivative(Tx0, Tx1, Ty0, Ty1, Td1); - Parameters:
T x0x0T x1x1T y0f( x0)T y1f( x1)T d1f'( x1) - const auto
opCall(uint derivative = 0)(Tx)
if (derivative <= 2); - alias
withDerivative= opCall!1; - alias
withTwoDerivatives= opCall!2;
- Unqual!(typeof(X.init - Y.init))[3]
parabolaDerivatives(X, Y)(in Xx0, in Xx1, in Xx2, in Yy0, in Yy1, in Yy2); - Returns:[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)));
Examples: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));
- struct
CubicKernel(T); - Cubic function structureExamples:
import mir.math.common: approxEqual; alias f = (double x) => 3 * x ^^ 3 + 7 * x ^^ 2 + 5 * x + 10; alias d = (double x) => 3 * 3 * x ^^ 2 + 2 * 7 * x + 5; alias s = (double x) => 6 * 3 * x + 2 * 7; auto x0 = 4; auto x1 = 9; auto p = CubicKernel!double.fromSecondAndFirstDerivative(x0, x1, f(x0), f(x1), s(x0), d(x1)); assert(p.a.approxEqual(3)); assert(p.b.approxEqual(7)); assert(p.c.approxEqual(5)); assert(p.d.approxEqual(10)); assert(p(13).approxEqual(f(13))); assert(p.opCall!1(13)[1].approxEqual(d(13))); assert(p.opCall!2(13)[2].approxEqual(s(13))); assert(p.opCall!3(13)[3].approxEqual(18));
- T
a; - T
b; - T
c; - T
d; - this(T
a, Tb, Tc, Td); - static CubicKernel
fromSecondAndFirstDerivative(Tx0, Tx1, Ty0, Ty1, Tdd0, Td1); - Parameters:
T x0x0T x1x1T y0f( x0)T y1f( x1)T dd0f''( x0)T d1f'( x1) - const auto
opCall(uint derivative = 0)(Tx)
if (derivative <= 3); - alias
withDerivative= opCall!1; - alias
withTwoDerivatives= opCall!2;
Copyright © 2016-2022 by Ilya Yaroshenko | Page generated by
Ddoc on Tue Jan 11 06:37:09 2022