butools.moments.MomsFromHankelMoms

butools.moments.MomsFromHankelMoms()
Matlab: m = MomsFromHankelMoms(hm)
Mathematica: m = MomsFromHankelMoms[hm]
Python/Numpy: m = MomsFromHankelMoms(hm)

Returns the raw moments given the Hankel moments.

The raw moments are: \(m_i=E(\mathcal{X}^i)\)

The ith Hankel moment is the determinant of matrix \(\Delta_{i/2}\), if i is even, and it is the determinant of \(\Delta^{(1)}_{(i+1)/2}\), if i is odd. For the definition of matrices \(\Delta\) and \(\Delta^{(1)}\) see [R37].

Parameters:

hm : vector of doubles

The list of Hankel moments (starting with the first moment)

Returns:

m : vector of doubles

The list of raw moments

References

[R37](1, 2) http://en.wikipedia.org/wiki/Stieltjes_moment_problem

Examples

For Matlab:

>>> M = [1.3, 2.4, 6.03, 20.5, 89.5, 474.9];
>>> hmoms = HankelMomsFromMoms(M);
>>> disp(hmoms);
          1.3         0.71        2.079       1.9973       13.841       44.916
>>> moms = MomsFromHankelMoms(hmoms);
>>> disp(moms);
          1.3          2.4         6.03         20.5         89.5        474.9
>>> err = norm(moms-M);
>>> disp(err);
    5.118e-13

For Mathematica:

>>> M = {1.3, 2.4, 6.03, 20.5, 89.5, 474.9};
>>> hmoms = HankelMomsFromMoms[M];
>>> Print[hmoms];
{1.3, 0.7099999999999995, 2.079000000000002, 1.997299999999989, 13.841272999999994, 44.91574881000027}
>>> moms = MomsFromHankelMoms[hmoms];
>>> Print[moms];
{1.3, 2.3999999999999995, 6.0299999999999985, 20.499999999999996, 89.50000000000006, 474.9000000000003}
>>> err = Norm[moms-M];
>>> Print[err];
3.4578811769837537*^-13

For Python/Numpy:

>>> M = [1.3, 2.4, 6.03, 20.5, 89.5, 474.9]
>>> hmoms = HankelMomsFromMoms(M)
>>> print(hmoms)
[1.3, 0.7099999999999995, 2.079000000000002, 1.997299999999989, 13.841272999999994, 44.91574881000027]
>>> moms = MomsFromHankelMoms(hmoms)
>>> print(moms)
[1.3, 2.3999999999999995, 6.0299999999999985, 20.499999999999996, 89.500000000000057, 474.90000000000032]
>>> err = la.norm(np.array(moms)-np.array(M))
>>> print(err)
3.4578811769837537e-13