var pid2 = pi() / 2
<?php // distribution.php // copyright john pezullo // released under same terms as php. // php port and oo'fying by paul meagher class distribution { function docommonmath($q, $i, $j, $b) { $zz = 1; $z = $zz; $k = $i; while($k <= $j) { $zz = $zz * $q * $k / ($k - $b); $z = $z + $zz; $k = $k + 2; } return $z; } function getstudentt($t, $df) { $t = abs($t); $w = $t / sqrt($df); $th = atan($w); if ($df == 1) { return 1 - $th / (pi() / 2); } $sth = sin($th); $cth = cos($th); if( ($df % 2) ==1 ) { return 1 - ($th + $sth * $cth * $this->docommonmath($cth * $cth, 2, $df - 3, -1)) / (pi()/2); } else { return 1 - $sth * $this->docommonmath($cth * $cth, 1, $df - 3, -1); } } function getinversestudentt($p, $df) { $v = 0.5; $dv = 0.5; $t = 0; while($dv > 1e-6) { $t = (1 / $v) - 1; $dv = $dv / 2; if ( $this->getstudentt($t, $df) > $p) { $v = $v - $dv; } else { $v = $v + $dv; } } return $t; } function getfisherf($f, $n1, $n2) { // implemented but not shown } function getinversefisherf($p, $n1, $n2) { // implemented but not shown } } ?>
新闻热点
疑难解答