Student.cin

From TORI
Revision as of 08:31, 9 May 2024 by T (talk | contribs) (Created page with "// Student.cin is C++ float implementation the first ten density functions of the Student Distribution. <pre> float Student(int n,float x) {float c[11]={0., 0.318...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

// Student.cin is C++ float implementation the first ten density functions of the Student Distribution.

float Student(int n,float x)
{float c[11]={0.,
0.31830988618379,
0.35355339059327,
0.36755259694786,
0.37500000000000,
0.37960668982249,
0.38273277230987,
0.38499145083227,
0.38669902096139,
0.38803490887167,
0.38910838396603};
return c[n]*pow(1.+x*x/n, -0.5*(n+1));
}

if n==0 echo " Attempt to evaluate density of the Student Distribution with zero degrees of freedom is detected. Sorry, but you need some freedom in order to perform the calculus. The country has performed an illegal operation (elimination of all freedoms) and will be shut down. In order to save your computer snd your life, please, move your computer out from the country, where all degrees of freedom are eliminated and clean your harddisk, screen of your monitor and your keyboard with ethanol.";


PHP

The testing of the coefficients can be performed with php code below:

<?php
echo 1/M_PI, "\n";
echo 1/sqrt(8), "\n";
echo 2/(M_PI*sqrt(3)), "\n";
echo 3/8, "\n";
echo 8/(3*M_PI*sqrt(5)), "\n";
echo 0, "\n";
echo 1/sqrt(2*M_PI), "\n";
?>

Warning

At the translation of code from PHP to C++, do not forget to add dot (.) to the numerical constants.

References

Keywords

«C++», «[[]]», «Density of probability», «PHP», «Student Distribution»,