The OpenD Programming Language

hermiteCoefficients

Physicist's Hermite polynomial coefficients

@safe pure nothrow
long[]
hermiteCoefficients
(
size_t N
)

Parameters

N size_t

Degree of polynomial

Examples

import mir.polynomial: polynomial;
import mir.rc.array: rcarray;
import mir.test: should;

auto h0 = hermiteCoefficients(0).rcarray!(const double).polynomial;
auto h1 = hermiteCoefficients(1).rcarray!(const double).polynomial;
auto h2 = hermiteCoefficients(2).rcarray!(const double).polynomial;
auto h3 = hermiteCoefficients(3).rcarray!(const double).polynomial;
auto h4 = hermiteCoefficients(4).rcarray!(const double).polynomial;
auto h5 = hermiteCoefficients(5).rcarray!(const double).polynomial;
auto h6 = hermiteCoefficients(6).rcarray!(const double).polynomial;
auto h7 = hermiteCoefficients(7).rcarray!(const double).polynomial;
auto h8 = hermiteCoefficients(8).rcarray!(const double).polynomial;
auto h9 = hermiteCoefficients(9).rcarray!(const double).polynomial;
auto h10 = hermiteCoefficients(10).rcarray!(const double).polynomial;

h0(3).should == 1;
h1(3).should == 6;
h2(3).should == 34;
h3(3).should == 180;
h4(3).should == 876;
h5(3).should == 3_816;
h6(3).should == 14_136;
h7(3).should == 39_024;
h8(3).should == 36_240;
h9(3).should == -406_944;
h10(3).should == -3_093_984;

Also works with @nogc CTFE

import mir.ndslice.slice: sliced;
import mir.test: should;

static immutable result = [-2, 0, 4];

static immutable hc2 = hermiteCoefficients(2);
hc2.sliced.should == result;

See Also

Meta