File: git_issue_800.cpp

package info (click to toggle)
scipy 1.16.0-1exp7
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 234,820 kB
  • sloc: cpp: 503,145; python: 344,611; ansic: 195,638; javascript: 89,566; fortran: 56,210; cs: 3,081; f90: 1,150; sh: 848; makefile: 785; pascal: 284; csh: 135; lisp: 134; xml: 56; perl: 51
file content (33 lines) | stat: -rw-r--r-- 1,329 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Matt Borland, 2022
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include "math_unit_test.hpp"
#include <boost/math/distributions/non_central_t.hpp>

template <typename T>
void test()
{
    boost::math::non_central_t_distribution<T> nct(T(10), T(3));

    // https://www.wolframalpha.com/input?i2d=true&i=N%5C%2891%29Kurtosis%5C%2891%29NoncentralStudentTDistribution%5C%2891%2910%5C%2844%29+3%5C%2893%29%5C%2893%29%5C%2844%2930%5C%2893%29
    CHECK_MOLLIFIED_CLOSE(boost::math::kurtosis(nct), T(5.44234533171835241424739188827L), 1e-6);

    boost::math::non_central_t_distribution<T> nct0(T(10), T(0));

    // https://www.wolframalpha.com/input?i2d=true&i=Kurtosis%5C%2891%29NoncentralStudentTDistribution%5C%2891%2910%5C%2844%29+0%5C%2893%29%5C%2893%29
    CHECK_ULP_CLOSE(boost::math::kurtosis(nct0), T(4), 1);

    // https://www.wolframalpha.com/input?i2d=true&i=ExcessKurtosis%5C%2891%29NoncentralStudentTDistribution%5C%2891%2910%5C%2844%29+0%5C%2893%29%5C%2893%29
    CHECK_ULP_CLOSE(boost::math::kurtosis_excess(nct0), T(1), 1);
}

int main(void)
{
    test<float>();
    test<double>();
    test<long double>();

    return boost::math::test::report_errors();
}